I want to import Caffe. I can import it in terminal but not in PyCharm.
I have tried some suggestions like adding include /usr/local/cuda-7.0/lib64
to /user/etc/ld.so.conf
file but still it can not import this module. However, I think this is not a good solution as I am using the CPU mode only.
I am using Linux Mint.
The output for sys.path
in PyCharm terminal is:
>>> sys.path
['',
'/home/user/anaconda2/lib/python27.zip',
'/home/user/anaconda2/lib/python2.7',
'/home/user/anaconda2/lib/python2.7/plat-linux2',
'/home/user/anaconda2/lib/python2.7/lib-tk',
'/home/user/anaconda2/lib/python2.7/lib-old',
'/home/user/anaconda2/lib/python2.7/lib-dynload',
'/home/user/anaconda2/lib/python2.7/site-packages',
'/home/user/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.1-y2.7.egg',
'/home/user/anaconda2/lib/python2.7/site-packages/setuptools-23.0.0-py2.7.egg']
>>>
and when I run sys.path
in PyCharm itself, I get:
['/opt/pycharm-community-2016.2.3/helpers/pydev',
'/home/user/',
'/opt/pycharm-community-2016.2.3/helpers/pydev',
'/home/user/anaconda2/lib/python27.zip',
'/home/user/anaconda2/lib/python2.7',
'/home/user/anaconda2/lib/python2.7/plat-linux2',
'/home/user/anaconda2/lib/python2.7/lib-tk',
'/home/user/anaconda2/lib/python2.7/lib-old',
'/home/user/anaconda2/lib/python2.7/lib-dynload',
'/home/user/anaconda2/lib/python2.7/site-packages',
'/home/user/anaconda2/lib/python2.7/site-packages/Sphinx-1.4.1-py2.7.egg',
'/home/user/anaconda2/lib/python2.7/site-packages/setuptools-23.0.0-py2.7.egg',
'/home/user/anaconda2/lib/python2.7/site-packages/IPython/extensions',
'/home/user/']
which is not exactly the same as the time I ran it in terminal.
moreover, as I run the import caffe
in PyCharm the error is as bellow:
/home/user/anaconda2/bin/python /home/user/important_commands.py
Traceback (most recent call last):
File "/home/user/important_commands.py", line 11, in <module>
import caffe
ImportError: No module named caffe
Process finished with exit code 1
Note: be sure your terminal is not activating some environment by default. It is a common case with the base environment after Anaconda/Miniconda installation. If it fails with the same error as in PyCharm - the problem is most likely not related to PyCharm.
You may as well copy the executed by PyCharm command from Run window, paste it to the terminal and run. Example of such command: - run pip install <package_name> or conda install <package_name> accordingly if you have problems installing a package in PyCharm;
And how you can add the file permanently to your Pycharm directory. Note: install pandas first if not already installed. Find the CSV file path you want to import or read in Pycharm. To find the CSV file on your computer, type the filename in the “Type here to search” taskbar in windows. Find that at the bottom left of your computer screen.
Right-click on the file you want and click “Copy full path”. Or click the arrow-head shape in front of the file you want and click “Copy full path”. Open Pycharm and write the below three-line code: Remember to include “r” first inside the bracket.
This solution worked for me. I think that the problem is that pycharm doesn´t charge the libraries from the bashrc.
Click the last button of the options (Brown bottom).
Add the python path (/home/user/caffe/python)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With