Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] pip list error when setup PYTHONPATH
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 454
Location: Rosario, Argentina

PostPosted: Sun Jan 12, 2025 9:08 pm    Post subject: [Solved] pip list error when setup PYTHONPATH Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22998

PostPosted: Mon Jan 13, 2025 1:50 am    Post subject: Reply with quote

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
View user's profile Send private message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 454
Location: Rosario, Argentina

PostPosted: Tue Jan 14, 2025 9:50 am    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22998

PostPosted: Tue Jan 14, 2025 3:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 454
Location: Rosario, Argentina

PostPosted: Tue Jan 14, 2025 7:17 pm    Post subject: Reply with quote

Thanks Hu for you help.

I did perform an pip uninstall pathlib from venv and all is running like I want.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum