Can't "Run" code from PyCharm CE when importing torch

Hi I have an issue when I try to import modules in PyCharm CE. I'm using Windows 10 and installed Anacoda. in PyCharm I imported the conda environement so the torch module is installed. If i run the code in the Anaconda prompt by using python -u Directory\of\mycode.py it works but when I try to run it with PyCharm it wont and give me this error:

Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\pydevconsole.py", line 5, in <module>
from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\_pydev_comm\rpc.py", line 4, in <module>
from _pydev_comm.server import TSingleThreadedServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\pydev\_pydev_comm\server.py", line 4, in <module>
from _shaded_thriftpy.server import TServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\third_party\thriftpy\_shaded_thriftpy\server.py", line 9, in <module>
from _shaded_thriftpy.transport import (
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\third_party\thriftpy\_shaded_thriftpy\transport\__init__.py", line 57, in <module>
from .sslsocket import TSSLSocket, TSSLServerSocket # noqa
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.4\helpers\third_party\thriftpy\_shaded_thriftpy\transport\sslsocket.py", line 7, in <module>
import ssl
File "C:\ProgramData\Anaconda3\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.

the interpreter of my project is Python 3.7.

In the execution configuration if I chose "Emulate terminal in output console" or "Run in python console" give me similar errors -> ImportError: DLL load failed etc...

Please help.

 

1 comment
Comment actions Permalink

Hi,

Seems like a known issue: https://youtrack.jetbrains.com/issue/PY-27234

Please try the workaround from there and let us know if this helps.

0

Please sign in to leave a comment.