Posts: 7,095
Threads: 122
Joined: Sep 2016
Aug-03-2022, 02:39 PM
(This post was last modified: Aug-03-2022, 02:40 PM by snippsat.)
(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.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
(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.
Posts: 4,510
Threads: 69
Joined: Jan 2018
Aug-05-2022, 06:31 AM
(This post was last modified: Aug-05-2022, 06:31 AM by Gribouillis.)
(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.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
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.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
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.
Posts: 4,510
Threads: 69
Joined: Jan 2018
Aug-05-2022, 06:03 PM
(This post was last modified: Aug-05-2022, 06:03 PM by Gribouillis.)
(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 ?
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
Aug-05-2022, 10:40 PM
(This post was last modified: Aug-05-2022, 10:40 PM by Skaperen.)
(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.
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
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.
Posts: 4,510
Threads: 69
Joined: Jan 2018
Aug-06-2022, 07:12 AM
(This post was last modified: Aug-06-2022, 07:13 AM by Gribouillis.)
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?
Posts: 4,560
Threads: 1,464
Joined: Sep 2016
(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.
|