pip requirement specifiers: role of the comma - python

I am trying to install a specific version of django-cms, thus executing pip install django-cms==3.0.5. That gives me the error No matching distribution found for django-mptt==0.5.2,==0.6,==0.6.1 (from django-cms==3.0.5). And indeed, on github the setup.py file specifies the requirement django-mptt==0.5.2,==0.6,==0.6.1.
The specification says that the comma serves as a logical 'and' operator but obviously no version can be 0.5.2, 0.6 AND 0.6.1 at the same time and thus the requirement is not matched. Just installing one of those versions via pip install django-mptt==0.5.2 works without a problem but there is still the same error about django-cms==3.0.5.
Can anyone shed light on this?

This was a bug in django-cms version 3.0.5. You can see the issue here: https://github.com/divio/django-cms/issues/3704.
You can try installing version 3.0.16 if you need to stay on the 3.0 release. If you REALLY need version 3.0.5, you can install pip==1.5.6, and django-cms should still install properly.
Edit Starting from pip version 6.0, multiple == version specifiers for a single package no longer work. One of the developers commented on Github:
This is the new expected behavior from PEP 440.
The old behavior of setuptools was confusing and didn't do what most
people expected it to do. PEP 440 simplified it by changing the , to a
logical AND statement.
See https://github.com/pypa/pip/issues/2258.

Related

Trying to install torch for unity mlagents in the virtual enveiroment

When i enter the command:
pip3 install torch~=1.7.1 -f https://download.pytorch.org/whl/torch_stable.html
just like the manual at
https://github.com/Unity-Technologies/ml-agents/blob/develop/docs/Installation.md
says, i get this error message:
ERROR: Could not find a version that satisfies the requirement torch~=1.7.1 (from versions: none)
ERROR: No matching distribution found for torch~=1.7.1
My pip is on version 23.0, python 3.11.1
I tried a bunch of different ways to do this, even from the torch website, but nothing seems to work, i still get the same error message.
~=1.7.1 means >= 1.7.1, == 1.7.*.
But as far as I can tell, the PyTorch releases in this version range do not support Python 3.11. You are probably following instructions that are quite old.
You would need to instruct pip to install newer releases of PyTorch. Or use an older Python version (probably 3.7 or 3.8 which are quite old and heave nearly reached end of life).

Pip package version conflicts despite seemingly matching ranges

When using pip install -r requirements.txt, I get ERROR: Cannot install -r requirements.txt (line 3), [...] because these package versions have conflicting dependencies..
And further:
The conflict is caused by:
tensorflow 2.11.0 depends on protobuf<3.20 and >=3.9.2
tensorboard 2.11.0 depends on protobuf<4 and >=3.9.2
wandb 0.13.5 depends on protobuf!=4.0.*, !=4.21.0, <5 and >=3.12.0
I don't see any conflicts in these ranges - every version in [3.12.0, 3.20) should be fine. Can someone explain the problem?
Update: As a workaround, I removed all version restrictions and only specified the names of the libraries in the requirements.txt file. Now it works. But I still don't see a problem with the above ranges, so I'll leave the question open.
I would suggest that, rather than using a range of versions, use a specific version you know works. That way, there won't be any problems.
I think that one of the versions of the dependencies is incompatible with the main module, and since it is within the range of versions you ask for, pip tries to intall it and fails to do so since it is incompatible.
Also, pip normally handles dependencies automatically.

'pip install pyeto' gives version and distribution error

I'm trying to install a package called pyeto. Their website (https://pyeto.readthedocs.io/en/latest/) does not mention any problems regarding the installation and I can't find any installation related problems of other users. I'm doubting what solution I should look for (I would appreciate it to not have to reinstall python). I'm running python version 3.6.8 and the errors are presented below.
If you have an idea on how to solve this issue please let me know. I'm not an expert on how python runs in the background and how packages are installed through pip. Thanks in advance! B.
ERROR: Could not find a version that satisfies the requirement pyeto (from versions: none)
ERROR: No matching distribution found for pyeto
EDIT: pip --version
pip 20.2.2 from c:\users\user\anaconda3\lib\site-packages\pip (python 3.6)
The author hasn't put it on pypi, so pip is treating it as an unknown package.
See https://github.com/woodcrafty/PyETo/issues/3
Check on the website on what version it is supported.

PIP install not recognizing versions

I have a custom pypi server, that I am installing files from. I attempt to upgrade from version 0.0.1 to a newer version of my own custom module. It is not detecting the later version. When I do a pip install 'mymodule>=17' I see:
Could not find a version that satisfies the requirement mymodule>=17
(from versions: 17.0828.222133-e1e0fd9, 17.0828.222305-e1e0fd9,
17.830.210154-e1e0fd9, 0.0.1)
Notice the versions show up, but it will never detect the 17.X versions with the git sha on the end. Ideas? Why would this be?
Due to the hyphen, 17.0828.222133-e1e0fd9 and the like are not valid version specifiers as defined in PEP 440. As a result, they are treated as "legacy version" strings by pip's internals and are sorted less than all valid version strings. Hence, as far as pip is concerned, these versions are not greater than 17.

Stable version of gevent?

There appears to be a stable and unstable version here: https://pypi.python.org/pypi/gevent#downloads
It's not entirely clear to me what the distinctions are. I'm guessing there's a stable version on pip, described under the heading "Get gevent", and there's a separate unstable version on github under the heading "Development".
I simply want to install the stable version for production usage. pip install gevent doesn't seem to be the proper way to do this, since it installs something that has a syntax error in line 289 of hub.py, and looking in there I realized that it's a completely different version of gevent from the most up-to-date version on Github.
How do I install gevent?
It looks like the current version on pypi is a release candidate and partially supports Python 3. If you want a stable version (that doesn't support python 3.x) you could try specifying the specific version when you invoke pip
pip install gevent==1.0.2
Alternately, you can install the version based on a specific commit on Github
pip install git+git://github.com/gevent/gevent.git#egg=gevent
This is what they are referring to as the development version. This means that you will be running the code as it exists on Github which could potentially be buggy but will include all latest changes to the codebase.
As a sidenote, if you're having issues with the version currently on pypi, you can see if the issues are reproducible using the most recent Github changes and submit a bug report to the developers.

Categories