Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't --user install in --system_site_packages virtualenvs when a conflict is present in the virtualenv site. #573

Closed
qwcode opened this issue Jun 10, 2012 · 9 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@qwcode
Copy link
Contributor

qwcode commented Jun 10, 2012

the sys.path ordering in a --system_site_packages virtualenv is this: virtualenv site, then usersite, then global site.
pip shouldn't allow a --user install if a conflict is present in the virtualenv site, because it won't have sys.path precedence and won't be importable.

this issue has been added to the --user fixes pull request plan as part5.
https://gist.github.com/gists/2822510

@qwcode
Copy link
Contributor Author

qwcode commented Jun 12, 2012

here's the install scenario that can happen with the latest code, if this isn't fixed

  1. pkg-1.3 installed in virtualenv site
  2. pkg-1.1 installed in usersite
  3. pip install --user pkg==1.2
  4. pip.req detects a VersionConflict with pkg-1.3 (due to it having sys.path precedence) and it ignores it
  5. pkg-1.2 gets installed alongside pkg-1.1 in the usersite

pnasrat added a commit that referenced this issue Jun 30, 2012
@pnasrat
Copy link
Contributor

pnasrat commented Jul 1, 2012

@qwcode Marcus - I noticed local failure on OS X when triaging other bugs - maybe loosen up the assert - also I note you're doing what looks like division not string concat - env.root_path / env.site_packages, we probably want os.path.join here

Do you want to fix up?

======================================================================
FAIL: tests.test_user_site.Tests_UserSite.test_install_user_in_global_virtualenv_with_conflict_fails
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/pnasrat/Development/pip/31/lib/python3.1/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/Users/pnasrat/Development/pip/tests/test_user_site.py", line 193, in test_install_user_in_global_virtualenv_with_conflict_fails
    %('INITools',env.root_path / env.site_packages)), result2.stdout
AssertionError: Will not install to the user site because it will lack sys.path precedence to INITools in /private/var/folders/00/0tcs0000h01000cxqpysvccm0039l4/T/tmppi_VNZ-piptest/.virtualenv/lib/python3.1/site-packages
Storing complete log in /var/folders/00/0tcs0000h01000cxqpysvccm0039l4/T/tmppi_VNZ-piptest/pip-log.txt

@pnasrat
Copy link
Contributor

pnasrat commented Jul 1, 2012

OK I see what is happening - real as /var is a symlink to private/var which is perfectly valid setup.

We probably should make the tests less brittle on the fs layout - maybe just assert contains error message, package and the env.site_packages. Other option is to enforce os.path.realpath in the test helper

actual=/private/var/folders/00/0tcs0000h01000cxqpysvccm0039l4/T/tmpCHPmJx-piptest/.virtualenv/lib/python3.1/site-packages
expected=/var/folders/00/0tcs0000h01000cxqpysvccm0039l4/T/tmpCHPmJx-piptest/.virtualenv/lib/python3.1/site-packages

@qwcode
Copy link
Contributor Author

qwcode commented Jul 10, 2012

fixed in pulls #585, #592

@qwcode qwcode closed this as completed Jul 10, 2012
@skyl
Copy link

skyl commented Jan 9, 2014

what if I want to force the install to the PYTHONUSERBASE?

@qwcode
Copy link
Contributor Author

qwcode commented Jan 9, 2014

@skyl you can do it in a different environment, that does not have the conflict scenario this issue deals with.

@skyl
Copy link

skyl commented Jan 9, 2014

the thing is, I still want the rules about whether or not to skip based on the requirement being already satisfied. I could use the system pip and install with --user but then I redundantly install a bunch of stuff that should be skipped based on what is already in the virtualenv.

@qwcode
Copy link
Contributor Author

qwcode commented Jan 9, 2014

yea, I can see possibly re-moving this restriction (and just logging warnings when "hidden" packages are installed). if you want to open a specific issue for that, please do. there's pros/cons either way.

but as for doing the --user install in another environment, you can target just the specific packages need using --no-deps if you're concerned about the redundancy.

@qwcode
Copy link
Contributor Author

qwcode commented Jan 9, 2014

just logged #1443

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

No branches or pull requests

3 participants