I am trying to use the Python requests module on Windows with Anaconda. After installing it with pip, attempting to import it fails because asn1crypto is required in the cryptography 2.2.2 module. After installing that with pip, it fails because the crypto library (that'd be crypto.dll on Windows) does not exist. Where the heck does this come from? The way asn1crypto uses it makes it seem like this is libcryptoXXX.dll, but I do not see any circumstance that it would be called crypto.dll. It looks like very old versions of pyOpenSSL (back when it was python-OpenSSL) came with crypto.so for Unix distributions, but I don't know where that came from and don't see any mention of a crypto.dll (and crypto.so was no longer distributed by the version of pyOpenSSL that requests says it requires). So what is this crypto.dll and where can I get it?
Setting expectations up front - all I've got to offer is a workaround and notes on my own experience.
I was faced with the same issue with Anaconda on Windows, and after going on a small adventure I simply removed asn1crypto from Anaconda. This raised an issue with a dependent package, so I removed that. 5 or 6 packages later I had a subset of Anaconda where Python code seems to successfully build and run.
My assessment is that this is an issue with Anaconda on Windows, specifically with asn1crypto (why do you expect and need "crypto.dll" on machines that don't have it, and offer no alternative?). I'd love to be wrong and for someone to tell me why.
My small adventure had me fruitlessly looking for the mysterious crypto library. I describe this below.
Looking for the "crypto.dll", I came across some questionable leads before landing here, which suggested I could pick up "libcrypto.dll" as part of an older version of OpenSSH for Windows. Not quite what I was looking for, but worth a try. Didn't work. Tried the 32 bit version (in path via system32) and the 64 bit version (in path via SysWOW64) with no luck. Tried the new and renamed to "libeay32.dll" version from a later release of OpenSSH on Windows. Didn't work. Tried the versions from OpenSSL on Windows (inexplicably renamed in the other direction). Tried masquerading these dlls as "crypto.dll", which just caused other errors.
Once again, I'd love for a more satisfying answer to exist (hint hint, future readers).
Related
Things were running along fine until one of my projects started printing this everywhere, at the top of every execution, at least once:
local/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
I have no idea why it started and it's disrupting the applications'/tools' output, especially when it's being captured and consumed by other tools. Like many difficulties throughout time, I'm fairly certain it is related to urllib and, by association, requests. Worse, I have so many projects and cross-dependencies that I can't possibly update all of the imports and branches with the call to warnings.filterwarnings() to suppress the warning.
I have Python 2.7.6 . Apparently this goes away in 2.7.7 . Only, I have some systems that have 2.7.6 where I do not see the warnings. So, something may or may not be disabling them in one version and I might've inadvertently replaced it with another version.
My Ubuntu, Python, urllib, requests (with the security option), cryptography, and hmac are all identical versions/builds on systems that do print the warning and systems that do not.
There appears to be no relevant warnings or announcements online and it seems like any related project is static/stable by this point (even though 'hmac' can be installed via PIP, it hasn't changed in eight years).
I hit this error for quite sometime. For my environment, it was a pain to upgrade Python to a higher version than 2.7.6. The easier solution was to downgrade cryptography module using pip:
pip2.7 install cryptography==2.2.2
I think the best solution is to upgrade your python version though
This answer is for Python3
I got here by looking for an answer while using Paramiko. For those still looking for a simple answer. I got these CryptographyDeprecationWarning suppresed with the these lines of code before importing Paramiko:
import warnings
warnings.filterwarnings(action='ignore',module='.*paramiko.*')
I hope this helps
If you want to be more selective about suppressing JUST that particular deprecation warning:
import warnings
from cryptography.utils import CryptographyDeprecationWarning
warnings.filterwarnings("ignore", category=CryptographyDeprecationWarning)
I started getting this warning for a straightforward requests.get call. This warning is printed when the module cryptography.hazmat.primitives.constant_time is loaded, and so this should typically only come once per Python program. If you are seeing it many times, it must be because a Python program (like a utility) is getting executed multiple times. You just have to identify that program and add the below code to the main entry point:
import cryptography
from cryptography import utils
with warnings.catch_warnings():
warnings.simplefilter('ignore', cryptography.utils.DeprecatedIn23)
import cryptography.hazmat.primitives.constant_time
I fixed this for all my local projects and tools using Python 2 by removing the warning from the python source code [your_installation_path]\Python\Lib\site-packages\cryptography\__init__.py
Just remove this snipped at the end of the file and delete the __init__.pyc file so its recompiled with the changes:
if sys.version_info[0] == 2:
warnings.warn(
"Python 2 is no longer supported by the Python core team. Support for "
"it is now deprecated in cryptography, and will be removed in the "
"next release.",
CryptographyDeprecationWarning,
stacklevel=2,
)
For Python3 only:
Per an apparent Paramiko update this worked for me and solve the similar problem/symptoms I was experiencing:
pip3 install --upgrade paramiko
This installed paramiko 2.6.0 on my system, replacing 2.4.2:
$ pip3 install --upgrade paramiko
[...]
Installing collected packages: paramiko
Found existing installation: paramiko 2.4.2
Uninstalling paramiko-2.4.2:
Successfully uninstalled paramiko-2.4.2
Successfully installed paramiko-2.6.0
$
My Python2 environment appears to be messed up, so I'm not able to test this on Python2.
When you do pip2.7 install cryptography==2.2.2, it appears the error might still occur.
I believe you need also sudo pip2.7 install --upgrade pip
Aso, as of 5/5/19 the newest appears to be cryptography=2.6.1
I'm running Anaconda/Spyder and I keep getting the Intel Math Library error shown in the picture:
It seems like an entry point for mkl_blas_dgem2vu is missing (whatever that is).
I was still able to run Spyder until I tried updating everything. After updating Spyder doesn't start after receiving this error.
I stuck and can't do anything right now.
Thanks.
I already found that post and it solved part of my problem.
First part of problem is that different a version of the MKL library was in the system32 & SYSWOW64 directories. It was loaded by another application. Anaconda was using those libraries instead of the one installed for Anaconda. I eliminated the other versions of the MKL libraries and reinstalled Anaconda. I tried without re-installing and it didn't work.
The 2nd problem was solved with that post you suggested that I found on my own. It seems like Spyder or Ipython is not compatible with the newest version of the MKL_intel_thread.dll library. I downgraded and I'm back in business.
I got this simple problem and I can't find the answer anywhere, I'm wasting a lot of time!
I did a Python programm on Linux (which works OK), but when I try to run it on Windows, there are too problems with libs...
I have installed the libs I need (dateutil, lxml, xmlrpclib...) in C:\Python34\Lib\site-packages. But then, they don't work as they do on Linux. For example:
from dateutil.tz import tzlocal
Gives me next error:
File "C:\Python34\lib\site-packages\dateutil\tz.py", line 9, in module
from six import string_types, PY3 ImportError: No module named 'six'
That is, they are not finding the other modules... why???
Have you try this ?
http://www.instructables.com/id/How-to-install-Python-packages-on-Windows-7/
Maybe it can help
It looks like you're using Python 3.4 which comes with pip. pip is a tool for installing packages and any dependencies they might have (like the srting_types module from your error message). I'd suggest learning how to use it because it resolves most of the packaging problems with you needing to moving things around yourself. See an answer from a different question to learn more about pip.
There are some packages that need to be compiled. This can be difficult on Windows 7 if you don't have the proper toolchain set up to compile packages. I'd recommend Christoph Gohlke's wonderful collection of installable packages for Windows. You just need to make sure to grab the right version. Since 3.4 is still relatively new, some packages may not be available, so be warned.
I am running python 2.7 in windows 7. I'd like to link up to mysql and found MySQLdb. I have tried easy_install mysql-python and found the /Z1 error. Although I downloaded the source, I'd like to avoid having to make all the changes to avoid the Z1 error (due to the source expecting the VC compiler that i don't have). i downloaded the 1.2.4 binary and installed. however, when i start up python and try "import MySQLdb", it does not find it.
i have looked at many pages. i am sure that i am overlooking something obvious, but i am new to python and i've run around in circles at so many pages.
please help.
edit: the installation actually worked. the problem is that i must have installed a 32 bit version. it works fine in IDLE which is using python 2.7.3 32 bit. but i was trying to use ipython and spyder, both were set up as 64.
i tried to install "unofficial version" from http://www.lfd.uci.edu/~gohlke/pythonlibs/ which i got from Python: How to install mysqldb on windows 7 x64?. it claims python 2.7 is not in registry. any help here would be welcome.
I did not solve the /Z1 issue. However, i did determine what i did wrong with the binary install. i had included /python27/LIB/site-packages/MySQLdb only. once i also added /python27/LIB/site-packages/MySQL_python.1.2.4b4-py2.7.egg-info it worked. i did not verify whether i need both in the pythonpath or not. but having both does work.
NOTE Added After: I finally got numpydoc working. It was also a python 2 problem. I ran 2to3 on it and now it seems to be working.
OK, I've spent an entire day trying to get any Sphinx extension to work and am now hoping someone could point out what I'm doing wrong. (Sorry this is a bit long, but maybe more info will help you quickly find the error of my ways).
Sphinx seems to be working as advertised, but I would like to use NumPy style documentation so thought I'd install numpydoc. In case it matters, I'm using Python 3.3 (winpython 64 bit on windows 7). I started with the directions here but got the error:
Extension error:
Could not import extension numpydoc (exception: cannot import name setup)
Googling that I found that some people got around it by using numpydoc.numpydoc No dice. I made sure everything possibly relevant was in my path (as well as added into sys.path in sphinx's conf.py file). I even tried copying numpydoc into sphinx's ext folder and changing the extension string accordingly, still no luck.
At this point I gave up on numpdoc and decided to try napoleon. Following the installation directions I just pip install sphinxcontrib-napoleon and then should be good to go. But alas, no, as napoleon seems to be in 2.x not 3 (though the egg says Sphinx-1.1.3-py3.3.egg-info and during installation it says it is installing sphinxcontrib_napoleon-0.2.1-py3.3-nspkg.pth. None-the-less, lots of python 2 code. I tried converting it with 2to3 but then I get a recursion too deep error.
So, I decide to see if I am capable of installing any extension to sphinx. I essentially at random pick findanything. Install it as requested and it also fails, this time because of a relpath error (ValueError: path is on mount 'C:', start on mount 'D:'). Which I guess means that it is unhappy that my python installation is on C but my code I'm trying to document (and where I'm trying to run sphinx) is on D (and that I'm running Windows).
So, did I just happen to pick 3 troubled extensions? Or, if not, what am I doing wrong and (more importantly) how can I do it right so that I get this working?
PS I'm completely new to Python so please don't assume that I'm not making an incredibly stupid and basic error.
Old thread, however...
If you are using Ubuntu 20+, don't install numpydoc via pip. Use
apt install python3-numpydoc
instead. Many of the sphinx packages need to be installed this way going forward.