pypa / packaging.python.org

Python Packaging User Guide
http://packaging.python.org
1.45k stars 933 forks source link

Namespace packages and bin directory replaced by latest package when PIP_TARGET is set #700

Closed anki-code closed 4 years ago

anki-code commented 4 years ago

Hello!

While I'm working on xxh/xxh I've faced with issue around PIP_TARGET environment variable and namespace packages.

When I set PIP_TARGET and then try to install group of subpackages then every new package just replace the latest.

For example there are two packages xonda and xontrib-autojump. Every package has namespace xontrib. If I install every package without setting PIP_TARGET I'll see in site-packages one directory xontrib with two files xonda.xsh and autojump.xsh.

But if I set PIP_TARGET:

# mkdir -p /home/pc/ppp
# export PIP_TARGET='/home/pc/ppp'
# pip install xonda
Successfully installed xonda-0.9.0
# ls /home/pc/ppp/xontrib/
xonda.xsh

# pip install xontrib-autojump
WARNING: Target directory /home/pc/ppp/xontrib already exists. Specify --upgrade to force replacement.
# ls /home/pc/ppp/xontrib/
xonda.xsh

# pip install --upgrade xontrib-autojump
Successfully installed xontrib-autojump-1.2
# ls /home/pc/ppp/xontrib/
autojump.xsh
$ pip --version                                                                                                                                                                                                                        
pip 20.0.2

As you can see the new package will just replace previous in xontrib directory instead of saving namespace.

Thank you for response and advices!

anki-code commented 4 years ago

The issue is also actual to $PIP_TARGET/bin directory. If we install two packages with executed files the latest package will replace bin directory.

anki-code commented 4 years ago

Almost 2 months passed. @brainwane @techalchemy @uranusjr could you please help? May be I'm doing this wrong way...

uranusjr commented 4 years ago

No idea why you’re tagging me but this sounds similar to pypa/pip#5178.

anki-code commented 4 years ago

@uranusjr sorry for mention I just don't know who is the right person and thank you for the link! I've found some thoughts! I'm going to rewrite the code to use $PYTHONUSERBASE.

pradyunsg commented 4 years ago

@anki-code Thanks for filing this issue but I'm afraid this is the wrong place for such support requests.

If you're still facing issues, I think that python-list or python-tutor mailing lists, or #python on Freenode (IRC) would be better channels to get support for the issue you're facing.

Thanks for understanding!