Python interface of Caffe: Error in "import caffe" - python

I'm trying to run Caffe in it's Python interface. I've already run the command make pycaffe in the caffe directory and it worked fine. Now, when I run the command import caffe in the python environment in the terminal (Ubuntu 14.04), I'm getting the following error:
>>> import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pras/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver
File "/home/pras/caffe/python/caffe/pycaffe.py", line 11, in <module>
import caffe.io
ImportError: No module named io
I tried to search my computer for 'caffe.io' but couldn't find any file by that name. Any idea why this error is occurring and how to correct it?

You need to add Python Caffe to PYTHONPATH. In your case:
export PYTHONPATH=$PYTHONPATH:/home/pras/caffe/python

Related

Import cv2 Error in google cloud virtual machine

I am currently trying to run a python script on a GCE virtual machine. However, I keep getting an error when using 'import cv2':
Traceback (most recent call last):
File "train.py", line 12, in <module> from deeplab.datasets import DataSetTrain, DataSetVal
File "/jet/prs/workspace/FYP-Project/Pytorch-Deeplab-master/deeplab/datasets.py", line 10, in <module>
import cv2
File "/jet/prs/workspace/lib/python3.6/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
The problem with this is that I have checked that the directory the file being referenced is present. I have installed and reinstalled cv2, however nothing seems to be working. None of the other modules that i installed using pip have this issue, it seems to only occur with cv2.

How to reinstall or fix Python interpreter for XCode lldb?

I got this message at XCode after deleting some system files.
(lldb) script
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'run_python_interpreter' is not defined
P.S. Had to reinstall XCode, but I've got same message at debugger after reinstalling IDE
Terminal output
$ lldb
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
You have a local installation of python on your computer (in /usr/local/Cellar). There's a problem when you have two different pythons on your system; lldb links against /System/Library/Frameworks/Python.framework but that python somehow ends up using the python libraries from your installed copy instead. I saw someone work around this once but I forget if it was by putting their local python last in $PATH or if they un-set their $PYTHONPATH before starting lldb.

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Can't find submodule in package

I'm using Anaconda3 version 4.2.0 on ubuntu (in docker).
Anaconda is installed in /root/anaconda3 folder.
I installed theano_bpr package using pip install theano_bpr.
Now when i open python and try import theano_bpr, i get the following message:
>>> import theano_bpr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/lib/python3.5/site-packages/theano_bpr/__init__.py", line 17, in <module>
from bpr import BPR
ImportError: No module named 'bpr'
However, when i navigate to /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ and run python there, i'm able to import theano_bpr.
In /root/anaconda3/lib/python3.5/site-packages/theano_bpr/ there are following files:
__init__.py, bpr.py (this one is causing problems), t.py, and utils.py.

Cuckoo xmlrpclib missing while uploading file

I recently set up Cuckoo environment on Arch Linux host with WXPSP3 guest.
When I try to upload file for analysis using submit.py I get the following error:
Traceback (most recent call last):
File "./utils/submit.py", line 23, in <module>
from lib.cuckoo.common.utils import to_unicode
File "/opt/cuckoo/utils/../lib/cuckoo/common/utils.py", line 11, in <module>
import xmlrpclib
ImportError: No module named 'xmlrpclib'
I run out of ideas. Could you help?
J
It works if I run python via python2.7 command so:
# python2.7 ./utils/submit.py <filepath>

Categories

Resources