View previous topic :: View next topic |
Author |
Message |
Fitap Guru
Joined: 13 Mar 2011 Posts: 454 Location: Rosario, Argentina
|
Posted: Sun Jan 12, 2025 9:08 pm Post subject: [Solved] pip list error when setup PYTHONPATH |
|
|
Hi there,
I get error from pip list when I setup PYTHONPATH environment to reach installed library to other software.
Code: | echo $PYTHONPATH
:/home/fitap/venv/lib/python3.12/site-packages
|
Code: | pip list
Traceback (most recent call last):
File "/usr/lib/python-exec/python3.12/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/fitap/venv/lib/python3.12/site-packages/pip/_internal/cli/main.py", line 11, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/fitap/venv/lib/python3.12/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/fitap/venv/lib/python3.12/site-packages/pip/_internal/cli/main_parser.py", line 9, in <module>
from pip._internal.build_env import get_runnable_pip
File "/home/fitap/venv/lib/python3.12/site-packages/pip/_internal/build_env.py", line 6, in <module>
import pathlib
File "/home/fitap/venv/lib/python3.12/site-packages/pathlib.py", line 10, in <module>
from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (/usr/lib/python3.12/collections/__init__.py) |
How can I solve it?
Thanks.
Last edited by Fitap on Tue Jan 14, 2025 7:17 pm; edited 1 time in total |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22998
|
Posted: Mon Jan 13, 2025 1:50 am Post subject: |
|
|
The pathlib.py installed in this virtualenv is not compatible with the collections installed system-wide. On my system, there exists a system-wide pathlib that does not have the bad import. What version is this virtualenv's pathlib? If it is not the latest, does removing the bad one result in a working pip? |
|
Back to top |
|
|
Fitap Guru
Joined: 13 Mar 2011 Posts: 454 Location: Rosario, Argentina
|
Posted: Tue Jan 14, 2025 9:50 am Post subject: |
|
|
Code: | pip show pathlib
Name: pathlib
Version: 1.0.1
Summary: Object-oriented filesystem paths
Home-page: https://pathlib.readthedocs.org/
Author: Antoine Pitrou
Author-email: solipsis@pitrou.net
License: MIT License
Location: /home/fitap/venv/lib/python3.12/site-packages
Requires:
Required-by: |
|
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22998
|
Posted: Tue Jan 14, 2025 3:06 pm Post subject: |
|
|
According to the documentation site linked in the output you provided: Pathlib: Install wrote: | In Python 3.4, pathlib is now part of the standard library. For Python 3.3 and earlier, easy_install pathlib or pip install pathlib should do the trick. | You are using Python 3.12, which is much newer than Python 3.4. Why are you still using a pathlib from pip in this version of Python? If you remove the pip version and rely on the standard library, does it work? |
|
Back to top |
|
|
Fitap Guru
Joined: 13 Mar 2011 Posts: 454 Location: Rosario, Argentina
|
Posted: Tue Jan 14, 2025 7:17 pm Post subject: |
|
|
Thanks Hu for you help.
I did perform an pip uninstall pathlib from venv and all is running like I want. |
|
Back to top |
|
|
|