Import cv2 Error in google cloud virtual machine - python

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.

Related

Issue running python script via PyCharm but not Anaconda Prompt

When I run a script in Anaconda Prompt, it works fine.
When I try to run it via PyCharm, I get this error related to the import of pandas.
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import pandas as pd
File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Process finished with exit code 1
If I try to import numpy and run it via PyCharm I get:
C:\ProgramData\Anaconda3\python.exe C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/MYUSERNAME/PycharmProjects/CARA/DocumentAccessCheck.py", line 2, in <module>
import numpy as np
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: The specified module could not be found.
Process finished with exit code 1
Running the same script in Anaconda prompt...no problem
My run configuration in PyCharm uses the Anaconda python distribution?
It should be noted that I am not using envirnoments, just the base Anaconda installation. More worryingly I dont see ANY Conda options in the project settings in PyCharm which a lot of tutorials seem to allude to.
Seems like a problem with the path for your scripts. Are you sure You have included your scripts in the PATH variable? If so are you sure your libraries are downloading/installing in that path?

getting this error while loading a tensorflow project

getting a error while a installing a tensorflow python project from https://github.com/victordibia/skyfall
first i tried to install the requiremnt.txt file i got Could not detect requirement name for 'git+https://github.com/dpallot/simple-websocket-server.git', please specify one with #egg=your_package_name error,
then i removed the last line of txt file, then getting this
Traceback (most recent call last):
File "app.py", line 18, in
from utils import web_socket_server
File "C:\Users\anurag\Downloads\skyfall-master\utils\web_socket_server.py", line 4, in
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
ModuleNotFoundError: No module named 'SimpleWebSocketServer'
after that i installed git , now getting this
Traceback (most recent call last):
File "app.py", line 19, in
from utils import web_socket_client
File "C:\Users\anurag\Downloads\skyfall-master\utils\web_socket_client.py", line 8, in
from websocket import WebSocketException, WebSocketConnectionClosedException
ImportError: cannot import name 'WebSocketException'
The error means that you have not installed this package: https://github.com/dpallot/simple-websocket-server
Try this to install it(you must have pip installed and also git) and then run the project again:
python -m pip install git+https://github.com/dpallot/simple-websocket-server.git

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.

Importing quandl using python 27

I'm trying to import quandl and have downloaded it from Github and unzipped it to C:\Python27\Lib\site-packages\quandl but whenever I run my file "quandltest.py", I get "ImportError: No module named inflection". I then downloaded inflection from Github and saved it to the site-packages folder but still get the following whenever I run the file. I'm using a Python 27 IDLE to import quandl (I get the same error using Pycharm). Anyone have any idea/the same issue?? Thanks! I also do not have access to my command window as it has been disabled by the admin so I cannot pip install.
Traceback (most recent call last):
File "C:/Python27/quandltest.py", line 1, in <module>
import quandl
File "C:\Python27\lib\site-packages\quandl\__init__.py", line 7, in <module>
from .model.database import Database
File "C:\Python27\lib\site-packages\quandl\model\database.py", line 11, in <module>
from quandl.connection import Connection
File "C:\Python27\lib\site-packages\quandl\connection.py", line 5, in <module>
from .util import Util
File "C:\Python27\lib\site-packages\quandl\util.py", line 1, in <module>
from inflection import parameterize
ImportError: No module named inflection

Python interface of Caffe: Error in "import caffe"

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

Categories

Resources