I am trying to install opencv in Python3.6 (or Python3.10) on a CentOS 7 Server from source, but I always get the error:
"No such file or directory: '_skbuild/linux-x86_64-3.6/cmake-install/python/cv2/__init__.py'"
I am struggling to figure out why this is occurring.
I am using:
cmake3.x86_64 0:3.17.5-1.el7
Python 3.6.8
opencv-python-4.5.5.64
To install OpenCV, I downloaded the tar.gz file from https://pypi.org/project/opencv-python/#files. I then ran:
easy_install-3.6 .
to install the package. This has worked in the past on this computer.
Any suggestions would be appreciated!
EDIT:
I was able to get OpenCV installed by downloading and installing the whl file from PyPI. Since my server is offline, I had to download the whl file. Then install the package using 'pip3 install '. Originally, I had glanced over the text that mentioned the failed OpenCV dependency (numpy) that was not installed and assumed that the whl file wouldn't work for my situation. So I no longer need a solution to this issue, but I leave this unanswered because I believe the installation from source should have worked.
I am trying to install dlib and run the code from here.
After installing dlib when I execute the line
python detect_face_features.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/image_1.jpg
I get the error
Illegal instruction: 4
I tried creating a virtual environment first and install dlib and opencv. The files get imported but on running the code on python I get the same error. I clean installed it on my root environment but still the same error. I can't figure out what library or file is broken as other python files work as expected.
I am working on MacOS 10.11.6 with XCode version 8.2.1
I installed the dlib with reference to this site.
Please tell me how to fix this. Thank you.
Edit: My MacBook is of mid 2010 build and it doesn't have AVX instructions built into it. I tried installing dlib again by explicitly switching off AVX instructions but the problem still persists.
sudo python3 setup.py install --no USE_AVX_INSTRUCTIONS
I also tried this solution but couldn't find the line
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
on dlib's path tools/python/CMakeLists.txt
Please tell me how can I fix this issue.
Thank You.
I am working on ssd - tensor flow project. For which I have to use cv2.
I am able to import it in Jupyter notebook as well as in terminal too.
On running the following command
print cv2.__version__
I am getting output:-
3.4.1
which surely means its installed successfully. (I used sudo pip install opencv-python command to install and had tried brew install as well to resolve the issue) , but still when I run my example.py files using terminal commands. they are giving the following error
No module named 'cv2
I had tried every possibility (by searching for every related issue but still not able to resolve it). Please help.
This worked for me:
sudo apt-get install libopencv-dev python-opencv
I am new to installing new python modules.
I installed tweepy using pip install tweepy. The installation was successful and 2 folders tweepy & tweepy-3.3.0.dist-info are created in the Lib/site-packages, hence I assumed all should be fine.
However, when I went to the IDE and import tweepy. It is unable to detect the module:
>>> import tweepy
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named tweepy
What is wrong?
I am running python 2.7.5.
[Update 1] I am using windows 7.
I first installed pip using another forum's suggestion (How do I install pip on Windows?). basically saving the get-pip.py script and double clicking it (unable to get "python get-pip.py" to work in cmd prompt as suggested). Then, I went to cmd and nagivated to C:/Python27/Scripts and type in pip install tweepy. I remembered seeing the result as a successful installation.
[Update 2] Using a file with import tweepy and running it, I have a similar error.
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\xxxx\Desktop\Script1.py", line 2, in <module>
from tweepy import Stream
ImportError: No module named tweepy
[Update 3] Typed "pip freeze" in cmd. It does show tweepy=3.3.0
C:\Python27\Scripts>pip freeze
oauthlib==0.7.2
requests==2.7.0
requests-oauthlib==0.5.0
six==1.9.0
tweepy==3.3.0
wheel==0.24.0
[Answer] Thanks for all the help guys, especially Cleb & omri_saadon suggestion that there might be something wrong with the file path.
I just realised that my GIS software, ArcGIS by default installed another Python into the Python27 folder, and everything is taken from that folder, C:\Python27\ArcGIS10.2, instead of C:\Python27. After I install tweepy from C:\Python27\ArcGIS10.2\Scripts, everything works well.
Try to pip uninstall tweepy
and then again pip install tweepy
Make sure you don't have several interpreters on your computer, if you have several, make sure that your pycharm(or any other editor you use) is configured with the same interpreter where you installed tweepy.
I tried this command py -m pip install tweepy and worked for me
If you are using Anaconda
conda install -c conda-forge tweepy
you may also use
easy_install tweepy
If you are using ubuntu try: sudo apt install python-pip
and then run: python3 -m pip install tweepy
I hope that helps!
If you are using conda enviroments and jupyter notebooks, you could try to install it from the notebook and restart the kernel:
!conda install -c conda-forge tweepy
The problem is that , tweepy in getting installed in the native python environment, i.e you might be able to import it in cmdline but must be getting error in jupyter notebook.
If this is the case, then you might need to install it with conda environment , with conda install tweepy. But if in this case also if you fail to install it due to conflicts errors thrown by conda do the following.....
Copy all the required tweepy pip files from the python environment, which you can find by running the pip install tweepy cmd which shows that the required package is already satisfied in a particular path.
You might be required to copy tweepy, requests, requests_oauthlib, oauthlib.
Paste the copied files into site-packages inside of Anaconda environment folder.
This solved the problem for me , hope it solves for you too.
If multiple versions of python are installed on the computer, you need to make sure under which version the package has been installed into. I have two versions of python installed on my mac, both python2 and python3 under /usr/local/lib path.
pipinstall tweepy only installs the package into python2.7/site-packages, while VSCode complies python3. Run pip3install tweepy to get the package under python3.7/site-packages so the module can be recognized by the compiler.
I had the same issue where after installing/ uninstalling via pip it still did not work. As a last ditch effort I actually moved the 'tweepy' folder in the '...Lib > site-packages' back to the main Python directory and 'import tweepy' then worked. No idea why this worked, but it did for me... Good luck!
I tried this, I was having the same error, but the thing that I did was, first installing the package using pip command, then spot the path where it got stored, then using os module change the directory to where the packages got stored, and then import it, it will work..
Very common error wherever your computer have different python environments in pycharm. Your computer may have different python interpreters as you install pip several times. Try to config the exact python interpreter using the following steps. PyCharm, Settings -> Project Interpreter -> This will show the installed package list and dedicated interpreter at the top right-hand side. Try your right interpreter within the dropdown.
If you are using Jupyter Notebook, just run the command below in the cell of the notebook.
!pip install tweepy
If you are using Jupyter notebook on Anaconda try:
sudo conda install tweepy
This worked for me on OSX.
The same for me, typing direct in the console import tweepy it works, but when I tried to run from the script it says 'No module named 'tweepy'' i tried to uninstall and install again but the solution was more simple,
instead of run like
C:\script.py
I run
C:\python script.py
It works, Python version is 3.6.2 tweepy version is 3.5.0
If you are using Jupyter Notebook, the only thing that worked for me was to first install Jupyter again
pip install jupyter
and then install tweepy
pip install tweepy
I'm trying to use a file that uses PIL and when I try to run it I get the following error:
ImportError: The _imaging C module is not installed
I know theres a bunch of threads online about this but most of them see pretty specific. I'm 100% sure there is no problem with the code I'm running. Python version 2.7.2 64bit windows 7. I've been trying to fix it for almost an hour or so and I'm losing my mind. Any suggestions?
try to install pillow. you can install it with the command: pip install pillow
you have install the python-imaging??
sudo apt-get install python-imaging. install first the python-imaging and next install the pillow
The error you're receiving suggests that the C library required by PIL is either not installed on your machine, or the directory in which it's installed is not on your path.
I would follow the instructions here: http://www.pythonware.com/products/pil/faq.htm
Search your system for _imaging.pyd
Check that the location of _imaging.pyd is on your path
Attempt to import the library from the command line with no accompanying code
If all of that works, please post your code, there is another problem.
On Ubuntu, the following command helped me (thanks to this answer on askubuntu):
sudo apt-get install libjpeg62:i386
I am on Windows, and had a problem ""ImportError: The _imaging C module is not installed"".
The problem solved by installing Pillow from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil. (it's given by a post however I can't locate it back..)