Pycharm error on import, even if it works in terminal

I installed the TensorFlow and scikit_learn packages and all its dependencies. When I try to import them using python 2.7.6 or 2.7.10 (I tried both) in the terminal, it works fine. However, when I do this with pycharm, it gives an error.

In the case of scikit_learn with the 2.7.6 launcher, it says: ImportError: the dynamic module does not define the init function (init_check_build)

In the case of scikit_learn with the 2.7.10 launcher, it says: ValueError: numpy.dtype is the wrong size, try recompiling

For TensorFlow with launcher 2.7.6 it says: ImportError: dlopen (/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 2): no suitable image found. Found: / Library / Python / 2.7 / site-packages / tensorflow / python / _pywrap_tensorflow.so: mach-o, but the wrong architecture

In the case of TensorFlow with launcher 2.7.10 it says: ImportError: there is no module named copyreg

Error importing tensor flow. If you are not using bazel, you should not try to import shadoworflow from its source directory; exit the tensor stream source tree and restart your python interpreter from there.

I tried to search the net, but the solutions for me did not work. I tried to remove them and install them again using pip, conda and directly from the source code, and it always gives the same errors. I even tried reinstalling pycharm with no luck.

Other libraries like scilab or numpy work great in pycharm.

Any ideas? It just makes me think. By the way, I am using Mac OS 10.10.5.

+2
source share
5 answers

In the end, I finished creating the virtual environment, reinstalled everything there and named it through pycharm. I’m not quite sure what the problem is between the condo and the picharm; I must have gone bad somewhere.

Now I use a different virtual environment depending on the project, and I'm happier than ever :).

0
source

you have to start PyCharm from the terminal

cd /usr/lib/pycharm-community/bin ./pycharm.sh

0
source

Add this parameter 'DYLD_LIBRARY_PATH = / usr / local / cuda / lib' to the Python environment variable. Run-> Edit Configurations -> Environment variables. Hope this works.

0
source

I had a similar problem. My code did not work on a PyCharm professional. I previously had PyCharm CE installed and it worked from there. I set up PyCharm CE some time ago, and I forgot which setting I used, but if problems persist, make sure the packages are installed in Settings> Project> Project Translator

0
source

Hey, if there are people with this problem, I would like to tell you about a solution. It works for me every time.

1. Opening of Picharma

2. Open PyCharmProject or the folder in which you are using

3.Click File and there Settings

4. Click Project: PyCharmProjects, there is a project interpreter

5.Select a global virtual environment for this (including a photo showing what I did)

6. Check if all packages that you installed are installed

This image

0
source

Source: https://habr.com/ru/post/1259103/


All Articles