1
votes

Stack: windows 8.1 Anaconda2/python 3.7 env Pycharm professional 2017.3

Problem: Can't import ssl module (narrowed down the problem to loading _ssl.pyd):

ImportError: DLL load failed: The specified module could not be found.

What i've tried:

If I use my windows console to activate the conda enviroment and try to import ssl it works

sys.path output in pycharm:

['C:/Users/vlad/Documents/DjangoProjects/cryptodata/playing_around_aiohttp', 'C:\Program Files\JetBrains\PyCharm 2017.3.3\helpers\pydev', 'C:\Program Files\JetBrains\PyCharm 2017.3.3\helpers\pydev', 'C:\Users\vlad\.PyCharm2017.3\system\cythonExtensions', 'C:\ProgramData\Anaconda2\envs\373\python37.zip', 'C:\ProgramData\Anaconda2\envs\373\DLLs', 'C:\ProgramData\Anaconda2\envs\373\lib', 'C:\ProgramData\Anaconda2\envs\373', 'C:\ProgramData\Anaconda2\envs\373\lib\site-packages', 'C:\Program Files\JetBrains\PyCharm 2017.3.3\helpers\pycharm_matplotlib_backend']

sys.path output in win console:

['', 'C:\ProgramData\Anaconda2\envs\373\python37.zip', 'C:\ProgramData\Anaconda2\envs\373\DLLs', 'C:\ProgramData\Anaconda2\envs\373\lib', 'C:\ProgramData\Anaconda2\envs\373', 'C:\ProgramData\Anaconda2\envs\373\lib\site-packages']

imp.find_module('_ssl') output in pycharm:

(<_io.BufferedReader name='C:\ProgramData\Anaconda2\envs\373\DLLs\_ssl.pyd'>, 'C:\ProgramData\Anaconda2\envs\373\DLLs\_ssl.pyd', ('.pyd', 'rb', 3))

imp.find_module('_ssl') output in windows console:

(<_io.BufferedReader name='C:\ProgramData\Anaconda2\envs\373\DLLs\_ssl.pyd'>, 'C:\ProgramData\Anaconda2\envs\373\DLLs\_ssl.pyd', ('.pyd', 'rb', 3))

In windows console I do "import _ssl" successfuly and then do

_ssl.__file__

the output of that is 'C:\ProgramData\Anaconda2\envs\373\DLLs\_ssl.pyd'

Am I missing something? What's going on here?

1
You should use Anaconda3 if you use Python 3. anaconda.com/distributionEskapp
Ok, i'll give it a new tryvladimir.gorea
Try to update PyCharm, many Anaconda issues had been fixed recentlyuser2235698

1 Answers

0
votes

Problem fixed by uninstalling Anaconda and using virtualenv instead. My decision of using virtualenv instead of Anaconda is subjective.

What I did:

  1. Uninstall Anaconda
  2. Install latest python
  3. Install pip
  4. Install virtualenv
  5. Create virtualenv inside each working project. Enable the enviroment with "env/Scripts/activate"
  6. Set pycharm project interpreter to the virtual environ executable. Pycharm should detect it by default