Python Forum
looking fo documentation for module files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
looking fo documentation for module files
#21
(Aug-02-2022, 06:10 PM)Skaperen Wrote: a link not for Numpy but just for Python would be better
Annual Release Cycle for Python
Now and start from Python 3.9 will a major versions be released October every year.
So in October will Python 3.11 be released.
Reply
#22
(Aug-01-2022, 08:22 PM)Gribouillis Wrote: I don't understand why you don't find a directory in our previous answers? What is the result of site.getsitepackages() in your system?
i'm looking for a specific path. something i can do this with:
cp -t $path skapmodule.py
Output:
>>> site.getsitepackages() ['/usr/host/bin/../../../local/lib/python3.8/dist-packages', '/usr/host/bin/../../../lib/python3/dist-packages', '/usr/host/bin/../../../lib/python3.8/dist-packages'] >>>
that doesn't seem right. none of those exist because it has "../../.." instead of "../..". i can't find where that is configured.

"/usr/host/bin" is where i keep locally created code because my setup process has to clear "/usr/host/bin" to empty and put the proper files in place, maybe without some that are not used, anymore. it's part of my custom management. the files then get copied to "/usr/local/bin" so all my local stuff is in both places. the trouble is some packages (that are not local) put stuff in "/usr/local". so i created "/usr/host". this was set up and was done long ago even before i started using Python (but most of that code has been rewritten into Python and works fin in Python3.8).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#23
(Aug-05-2022, 02:42 AM)Skaperen Wrote: that doesn't seem right. none of those exist because it has "../../.." instead of "../..". i can't find where that is configured.
Try to print sys.prefix and sys.exec_prefix. Did you compile Python from source ? Also look at the code of getsitepackage() in site.py to understand what it does.
Reply
#24
i did not compile python from source. it came included with Xubuntu 20.04 which share a repository with Ubuntu 20.4. both have python3.8.

that ../../.. issue looks like it may also be why pip i failing, and installed things at the wrong place until i blocked it. it was installing in directory /local. so i put a regular file there and it can't create that directory, now. the first path from site.getsitepackages() (see post #22) ends up referring to there.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#25
so now i really need to know where that ../../.. comes from. perhaps pip used site.getsitepackages() to go there. so, now, if someone knows where site.getsitepackages() gets the first path from, they could help. where does python look for modules before it has site loaded so it can find site.py?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#26
(Aug-05-2022, 05:41 PM)Skaperen Wrote: where does python look for modules before it has site loaded so it can find site.py?
I think it is in <base_exec_prefix>/lib/pythonX.Y where the prefix is the value of sys.base_exec_prefix and X.Y is for example 3.8

Which values do you have for sys.exec_prefix and sys.base_exec_prefix ?
Reply
#27
(Aug-05-2022, 06:03 PM)Gribouillis Wrote: Which values do you have for sys.exec_prefix and sys.base_exec_prefix ?

Output:
lt1a/forums/3 /home/forums 4> site.getsitepackages;sys.base_exec_prefix;sys.exec_prefix ['/usr/host/bin/../../../local/lib/python3.8/dist-packages', '/usr/host/bin/../../../lib/python3/dist-packages', '/usr/host/bin/../../../lib/python3.8/dist-packages'] '/usr/host/bin/../../..' '/usr/host/bin/../../..' lt1a/forums/3 /home/forums 5> which site.getsitepackages sys.base_exec_prefix sys.exec_prefix /usr/host/bin/site.getsitepackages /usr/host/bin/sys.base_exec_prefix /usr/host/bin/sys.exec_prefix lt1a/forums/3 /home/forums 6> box $(which site.getsitepackages sys.base_exec_prefix sys.exec_prefix) +----</usr/host/bin/site.getsitepackages>----+ | #!/usr/bin/env python3 | | import site | | print(repr(site.getsitepackages())) | +--------------------------------------------+ +----</usr/host/bin/sys.base_exec_prefix>----+ | #!/usr/bin/env python3 | | import sys | | print(repr(sys.base_exec_prefix)) | +--------------------------------------------+ +----</usr/host/bin/sys.exec_prefix>----+ | #!/usr/bin/env python3 | | import sys | | print(repr(sys.exec_prefix)) | +---------------------------------------+ lt1a/forums/3 /home/forums 7>
there is a lot of stuff in /usr/host/bin/../../../lib/python3.8 (which is really /usr/lib/python3.8). nothing has "../../..". any idea which file it might be looking for?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#28
now to find out where python3.8 gets sys.base_exec_prefix and sys.exec_prefix from.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#29
Do you by any chance have a PYTHONHOME environment variable defined ?

Python documentation Wrote:PYTHONHOME
Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.

When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.
What is the output of
Output:
$ env | grep PYTHON
on your system?
Reply
#30
(Aug-06-2022, 07:12 AM)Gribouillis Wrote: Do you by any chance have a PYTHONHOME environment variable defined ?

Python documentation Wrote:PYTHONHOME
Change the location of the standard Python libraries. By default, the libraries are searched in prefix/lib/pythonversion and exec_prefix/lib/pythonversion, where prefix and exec_prefix are installation-dependent directories, both defaulting to /usr/local.

When PYTHONHOME is set to a single directory, its value replaces both prefix and exec_prefix. To specify different values for these, set PYTHONHOME to prefix:exec_prefix.
What is the output of
Output:
$ env | grep PYTHON
on your system?

No.

Output:
lt1a/forums/1 /home/forums 4> env | grep PYTHON PYTHONSTARTUP=.init.py PYTHONPATH=/home/forums:/home/forums/py:/home/forums/py/lib:/home/forums/lib:/usr/host/lib/py:/usr/host/lib:/usr/local/lib/py:/usr/local/lib PYTHONDONTWRITEBYTECODE=True lt1a/forums/1 /home/forums 5> box /usr/host/bin/{site,sys}.* +----</usr/host/bin/site.getsitepackages>----+ | #!/usr/bin/env python3 | | import site | | print(repr(site.getsitepackages())) | +--------------------------------------------+ +----</usr/host/bin/sys.base_exec_prefix>----+ | #!/usr/bin/env python3 | | import sys | | print(repr(sys.base_exec_prefix)) | +--------------------------------------------+ +----</usr/host/bin/sys.exec_prefix>----+ | #!/usr/bin/env python3 | | import sys | | print(repr(sys.exec_prefix)) | +---------------------------------------+ lt1a/forums/1 /home/forums 6> /usr/host/bin/site.getsitepackages;/usr/host/bin/sys.base_exec_prefix;/usr/host/bin/sys.exec_prefix ['/usr/host/bin/../../../local/lib/python3.8/dist-packages', '/usr/host/bin/../../../lib/python3/dist-packages', '/usr/host/bin/../../../lib/python3.8/dist-packages'] '/usr/host/bin/../../..' '/usr/host/bin/../../..' lt1a/forums/1 /home/forums 7>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  finding which source files import a module Skaperen 3 2,480 Apr-22-2019, 09:28 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020