You are not logged in.

#1 2018-08-30 13:43:22

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

[SOLVED] Unable to use pip and virtualenv from packages

I install virtualenv and pip by:

pacman -S python-virtualenv python-pip

When running both tools, I get error of the same structure:

$ pip --version
Traceback (most recent call last):
  File "/usr/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==18.0' distribution was not found and is required by the application
$ virtualenv --version
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3095, in <module>
    @_call_aside
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 570, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 888, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 774, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==16.0.0' distribution was not found and is required by the application

Can't work out what's the reason, nor how to fix it. Can somebody help?

Last edited by no-cheating (2018-08-30 13:57:11)

Offline

#2 2018-08-30 13:48:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Unable to use pip and virtualenv from packages

Looks like a partial upgrade.

EDIT: confirmed in the archive, you could not have pip 18 and python 3.6 unless you were doing partial upgrades.  Upgrade your system.

https://bbs.archlinux.org/viewtopic.php?id=130309

Last edited by Trilby (2018-08-30 13:50:24)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2018-08-30 13:56:17

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

Re: [SOLVED] Unable to use pip and virtualenv from packages

Trilby wrote:

Looks like a partial upgrade.

EDIT: confirmed in the archive, you could not have pip 18 and python 3.6 unless you were doing partial upgrades.  Upgrade your system.

https://bbs.archlinux.org/viewtopic.php?id=130309

True. I installed python-pip and python-virtualenv packages, but haven't updated the main python package. Now that I've done it, everything works fine. Thanks.

Last edited by no-cheating (2018-08-30 13:56:59)

Offline

#4 2018-08-30 13:59:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Unable to use pip and virtualenv from packages

Note that this would not have happened if you were not also doing partial upgrades which you should never do.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2018-08-30 14:02:09

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

Re: [SOLVED] Unable to use pip and virtualenv from packages

What do you mean? If I do:

pacman -S <package>

And that package is already installed, is that a partial upgrade?

Offline

#6 2018-08-30 14:07:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: [SOLVED] Unable to use pip and virtualenv from packages

If you've updated the databases without updating the entire system, yes.

Offline

#7 2018-08-30 14:09:54

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

Re: [SOLVED] Unable to use pip and virtualenv from packages

So I should always check, if the package I'm installing has been already installed (cause pacman doesn't signal the difference between install and upgrade) and if it has and I want to upgrade it, I should upgrade the whole system. Do I get it right?

Offline

#8 2018-08-30 14:10:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Unable to use pip and virtualenv from packages

https://wiki.archlinux.org/index.php/Sy … nsupported

Using `pacman -S <package>` should never be unsafe.  The worst that could happen if you haven't updated in a while is that you will get a 404 response due to the package version in your local database no longer being available on the mirrors.

The problem comes from any use of `pacman -Sy` (other than `pacman -Syu`) as that updates your local databases, but doesn't update the packages.  So any future package installations will get a version that wasn't intended to be beside the other packages you have installed.  Incidentally, you can also get into a similar situation of you attempt a `pacman -Syu` but then Ctrl-C or otherwise cancel it before it finishes, and then subsequently don't bother completing the update.

EDIT:

no-cheating wrote:

So I should always check, if the package I'm installing has been already installed

No, that's really not relevant.  Just never run `pacman -Sy` and you will not have this sort of problem.  It is good practice to update regularly, and some archers suggest you should update every time you are installing new packages - but neither of those steps are actually necessary to avoid partial upgrades.  The only thing needed to avoid partial ugrades is to not do silly pointless things like `pacman -Sy`.

Last edited by Trilby (2018-08-30 14:12:37)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2018-08-30 14:14:19

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

Re: [SOLVED] Unable to use pip and virtualenv from packages

Trilby wrote:

https://wiki.archlinux.org/index.php/Sy … nsupported

Using `pacman -S <package>` should never be unsafe.  The worst that could happen if you haven't updated in a while is that you will get a 404 response due to the package version in your local database no longer being available on the mirrors.

The problem comes from any use of `pacman -Sy` (other than `pacman -Syu`) as that updates your local databases, but doesn't update the packages.  So any future package installations will get a version that wasn't intended to be beside the other packages you have installed.  Incidentally, you can also get into a similar situation of you attempt a `pacman -Syu` but then Ctrl-C or otherwise cancel it before it finishes, and then subsequently don't bother completing the update.

EDIT:

no-cheating wrote:

So I should always check, if the package I'm installing has been already installed

No, that's really not relevant.  Just never run `pacman -Sy` and you will not have this sort of problem.  It is good practice to update regularly, and some archers suggest you should update every time you are installing new packages - but neither of those steps are actually necessary to avoid partial upgrades.  The only thing needed to avoid partial ugrades is to not do silly pointless things like `pacman -Sy`.

Finally I get it. Thanks for the detailed explanation.

And yeah, I've done pacman -Syy today after I started getting some errors of being unable to download the package I wanted to install. Now I know I shouldn't have done that.

And as for the updates, I try to update the whole system once a week.

Last edited by no-cheating (2018-08-30 14:15:55)

Offline

#10 2018-08-30 14:16:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] Unable to use pip and virtualenv from packages

I'd encourage you to update more frequently.  But if you do continue to update at longer intervals, just note that the next time you try to install a new package and get a similar 404 error, the correct solution is then to `pacman -Syu <packagename>`.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2018-08-30 14:20:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,694

Re: [SOLVED] Unable to use pip and virtualenv from packages

no-cheating wrote:

And as for the updates, I try to update the whole system once a week.

Try harder. Python was updated to 3.7 in Extra three and a half weeks ago.

Offline

#12 2018-08-30 14:46:16

no-cheating
Member
From: Poland
Registered: 2016-04-26
Posts: 61

Re: [SOLVED] Unable to use pip and virtualenv from packages

Scimmia wrote:
no-cheating wrote:

And as for the updates, I try to update the whole system once a week.

Try harder. Python was updated to 3.7 in Extra three and a half weeks ago.

Okay, I will smile.

Offline

#13 2018-08-30 23:22:12

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 713

Re: [SOLVED] Unable to use pip and virtualenv from packages

Slightly off-topic, but OP you generally don't need to install either of those packages anyhow because you can create a virtual env and install via pip using standard python since at least python 3.4:

python -m venv env
env/bin/pip install <whatever>

I often throw the following line between the 2 above just to ensure I use the latest pip in that venv:

env/bin/pip install -U pip

Offline

Board footer

Powered by FluxBB