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

Comments

Projects
None yet
3 participants
@qwcode
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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Jun 12, 2012

Contributor

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
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@pnasrat

pnasrat Jul 1, 2012

Contributor

@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
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

This comment has been minimized.

Show comment
Hide comment
@pnasrat

pnasrat Jul 1, 2012

Contributor

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
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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Jul 10, 2012

Contributor

fixed in pulls #585, #592

Contributor

qwcode commented Jul 10, 2012

fixed in pulls #585, #592

@qwcode qwcode closed this Jul 10, 2012

@skyl

This comment has been minimized.

Show comment
Hide comment
@skyl

skyl Jan 9, 2014

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

skyl commented Jan 9, 2014

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

@qwcode

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Jan 9, 2014

Contributor

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

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@skyl

skyl 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.

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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Jan 9, 2014

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@qwcode

qwcode Jan 9, 2014

Contributor

just logged #1443

Contributor

qwcode commented Jan 9, 2014

just logged #1443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment