-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Case sensitive issue on Windows #3309
Comments
So crypto and pycrypto both claim the name "crypto" for imports (with one claiming it in lowercase, and the other with an initial capital)? This is a bug (or incompatibility) in those packages, as they are using the same name. PyPI only mandates uniqueness of distribution names, not of the import names used by distributions. But one or the other package should probably change. From the project upload dates, pycrypto is the older package, but using an import name that doesn't match the project name means that it's not exactly the crypto project's fault that they didn't know the name crypto was in use. |
Sure, but I figure the issue here is that pip doesn't correctly rename the dir it's installing to. I think that (trashing the old install) is actually saner behaviour than silently installing to a dir with a name in different case. Although contrived, i think by demonstrating that creating a dir 'crypto' and then installing PyCrypto, and it succeeding shows why I consider this a bug in |
Ah, I see your point. Personally, I'm inclined to treat it as a case of "don't do that" rather than being something it's worth working round in pip, but if someone were to feel strongly enough to create and merge a fix, I wouldn't object. |
I'd also go on the "don't do that" side:
|
Then could the bug be that python is case sensitive, but pip/wheel/setuptools is not? Not sure how you'd work around this on osx/windows, though, so it makes sense that it's a 'don't do this' kind of thing, but how do we warn others? |
Well this is not a case sensitivity issue: different packages can legitimately install in the same directory like And in the case of namespaced package, it is expected that several packages will write in the same directory so I don't think there is a better solution than Do not do this. |
if os.path.isdir(path) and os.path.basename(path) != os.path.basename(path.lower()):
... or similar could test, at the time of installation, whether there's going to be a failure. There's no real way to prevent this issue, but I think it's better to warn than to fail silently. The issue isn't collisions -- That's expected. The issue, imo, is that pip installs without complaint or warning. Easy repro steps: ~/tmp 09:09:46$ python -m virtualenv delme
New python executable in delme/bin/python
Installing setuptools, pip, wheel...done.
~/tmp 09:09:58$ . delme/bin/activate
(delme)~/tmp 09:10:14$ pip install crypto
Collecting crypto
Downloading crypto-1.4.1-py2.py3-none-any.whl
Collecting Naked (from crypto)
Downloading Naked-0.1.31-py2.py3-none-any.whl (590kB)
100% |████████████████████████████████| 593kB 782kB/s
Collecting shellescape (from crypto)
Downloading shellescape-3.4.1-py2.py3-none-any.whl
Collecting requests (from Naked->crypto)
Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
100% |████████████████████████████████| 503kB 1.0MB/s
Collecting pyyaml (from Naked->crypto)
Installing collected packages: requests, pyyaml, Naked, shellescape, crypto
Successfully installed Naked-0.1.31 crypto-1.4.1 pyyaml-3.11 requests-2.9.1 shellescape-3.4.1
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(delme)~/tmp 09:10:21$ ls delme/lib/python2.7/site-packages/
Naked _markerlib crypto-1.4.1.dist-info pip requests setuptools-18.2.dist-info wheel
Naked-0.1.31.dist-info _yaml.so easy_install.py pip-7.1.2.dist-info requests-2.9.1.dist-info shellescape wheel-0.24.0.dist-info
PyYAML-3.11.dist-info crypto easy_install.pyc pkg_resources setuptools shellescape-3.4.1.dist-info yaml
(delme)~/tmp 09:10:43$ pip install pycrypto
Collecting pycrypto
Installing collected packages: pycrypto
Successfully installed pycrypto-2.6.1
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(delme)~/tmp 09:10:48$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Crypto.Cipher import AES
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Crypto.Cipher
>>> from crypto.Cipher import AES
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/grazfather/tmp/delme/lib/python2.7/site-packages/crypto/Cipher/AES.py", line 49, in <module>
from Crypto.Cipher import blockalgo
ImportError: No module named Crypto.Cipher |
But there are a lot of cases where there is no reason to warn if two packages install themselves in the same directory. Cf all the One thing that could maybe be done, would be to load all the installed files in the environment (from |
I think you're missing the point. I don't think that they should check that they install to the same dir, i think they should check that if the target directory exists, but its case is different, then warn that it WILL break. |
I did miss your point and now, just like pfmoore:
Note that depending on the fix, it might also have to go in setuptools. |
Great. I will look into it, but unfortunately both projects are unfamiliar to me. |
HI all, I am also facing same issue. If you found the solution that will be great help. And let me also know the solution. I have a workaround for this issue. So what i have done is. so i have installed Crypto using PIP and then also i got same issue. I just renamed the crypto folder to Crypto as below go to -> C:\Python34\Lib\site-packages Then its started working as expected........ :) hope this will help you. |
Closing this. You can't install two distributions with the same name, and on a case insensitive FS that extends to the name of the python packages as well. |
Sure it's not supported, but pip could do a lot better at handling it or warning. At least this'll show up on google. |
pip install crypto
-> Creates lowercase crypto in site-packagespip install pycrypto
-> Installs pycrypto to 'Crypto', but because the fs on windows is case-insensitive, it installs to the already existing crypto.python -m Crypto
->ImportError: No module named Crypto
see pycrypto/pycrypto#156
The text was updated successfully, but these errors were encountered: