Im just new to Python and trying to run a scripts online code here
However one error occurred:
File "C:\Python27\track.py", line 1,in <module>
import cv
ImportError: No module named cv
Can someone enlighten me?
Install OpenCV
https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html
It needs this package to function
Look at here http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian, 'Making Python work';
third option worked for me but there is a bug there, the correct line to add bashrc is
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
this can vary according to your python installation though.
Related
I was following along a tutorial where they used the SpeechRecognition module, but when I made it to the first test it returns C:\Users\USER\PycharmProjects\Fatawi\venv\Scripts\python.exe C:/Users/USER/PycharmProjects/Fatawi/main.py Traceback (most recent call last): File "C:\Users\USER\PycharmProjects\Fatawi\main.py", line 1, in <module> import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition'
I've tried reinstalling the library multiple times along with the PyAudio library. I ran the test that PyPi has for it and it works, but I don't know how fix it from here.
Check your python interpreter environment (the python version that's run the python file) maybe it's not the same version as python when you downloaded Speech Recognition.
Check if you activating the environemt.
For better understand see this blog in geeks for geeks might help you.
So aftergoing through some of the settings of the project file and checking the Python Interpreter it didn't have the SpeechRecognition Package. So I'm assuming that something went wrong with the install.
Thank you Faisal Faraj for the help.
My code has this import code:
import tia.analysis.ta as ta
And this is on init.py line 2 in "/usr/local/lib/python2.7/dist-packages/tia/analysis" after import code above:
from tia.analysis.model import *
Then the python 2.7.12 shell show this:
import tia.analysis.ta as ta
File "/usr/local/lib/python2.7/dist-packages/tia/analysis/__init__.py", line 2, in <module>
from tia.analysis.model import *
ImportError: No module named model
Can somebody tell me why the 'model' module in tia.analysis is unavailable even after I successfully install tia and using Python 2.7?
If somebody can also tell me the solution, I will be grateful.
I am not sure why that is happening, but I would check the physical location where the library is and see if you have all the files installed. If not, you can grab the tia analysis model folder here. Make sure you have this folder and then try again, hopefully that should fix it.
Reinstall tia from the official source.
Official source and installation instructions can be found here.
I am using the tensorflow object detection api from https://github.com/tensorflow/models and I am trying to make an object detection program using open cv with tensorflow. When the code reaches at line 30 (see code below), the program will get an error and will print:
Traceback (most recent call last):
File "C:\Users\xxx\Documents\models\research\object_detection\object_detection.py", line 31, in
from object_detection.utils import ops as utils_ops
File "C:\Users\xxx\Documents\models\research\object_detection\object_detection.py", line 31, in
from object_detection.utils import ops as utils_ops
ImportError: No module named 'object_detection.utils'; 'object_detection' is not a package
I tried the solutions that are in this link (Tensorflow Object Detection API on Windows - error "ModuleNotFoundError: No module named 'utils'") step by step, but it still didn't work. I don't know what should be targeted in order to solve this problem. Also, I am not that familiar with machine learning, tensorflow, and opencv, I just start learning it now. Can anyone please help me with this? Thanks in advance.
Btw, this is the part of the code where I got a problem with.
# This is needed since the notebook is stored in the object_detection folder.
sys.path.append("..")
from object_detection.utils import ops as utils_ops
I tried the 'export path' method on python and the 'Develop' method for Conda but nothing worked.
Finally tried installing this API and the tutorial worked. Maybe I missed this step during the installation. You try this too
pip install tensorflow-object-detection-api
I have followed below steps:
For every new terminal, append PYTHONPATH as follows:
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
from directory C:\Users\xxx\Documents\models\research
Else, add that particular line to ~/.bashrc file in order to avoid running for every new terminal.
In my python code I want to use a module called "topicmodels" (that can be found here https://github.com/sekhansen/text-mining-tutorial). The problem with this module is that whenever I want to "import topicmodels" in my Python code, I get the error message:
ImportError: No module name preprocess, more specifically in that topicmodels module is a Python file init.py that contains the line " from preprocess import * ". I googled and did not find a python module called preprocess - can anybody help me out on this?
(I am using Kubuntu and Python 3.5.2 | Anaconda 4.2.0).
Thanks a lot for any help!
This code is written for Python 2. You're on Python 3. The failing import is an implicit relative import, which Python 3 prohibits.
Run it on Python 2.
pip install preprocessing
Reference: https://pypi.org/project/preprocessing/
I have been trying to import modules into Ninja IDE for python. These are modules that I have working on the terminal (numpy, scipy, scitools, matplotlib, and mpl_toolkits), but will not run correctly in Ninja.
First I was only getting the message No module named ____. I checked sys.path and found that the path was within the application
/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7 was a typical path. I tried changing the path,but it doesn't seem to do anything to sys.path even after restarting the ide.
But I wanted the path to refer to where the modules are stored (which is /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages). I was able to get numpy and scipy to work as well as parts of mpl_toolkits by adding the contents of my path to the folders that sys.path gave. However, I still can't get fully functioning modules within the ninja ide interpreter. I'll give some examples below of what happens when I import certain modules.
import matplotlib.pyplot
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfig
import mpl_toolkits
from mpl_toolkits.mplot3d import axes3d
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/__init__.py", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 14, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfig
Thanks for the help. I apologize, I am very new to programming, but I did put in about a day and a half of research before posting here.
That's strange as the sysconfig module is a part of Python 2.7 standard library.
Are you sure that Ninja is using the right Python version? Try running:
import sys
print sys.version_info
from Ninja, to see which Python version it is actually using.
I know this question is a few months old, but I wanted to post my solution in case others find it useful. I had a very similar problem, and had a lot of trouble finding a quick workable solution anywhere.
My somewhat roundabout solution was to simply create a virtualenv folder with the version of numpy I wanted, and then pointed the "virtualenv" property for NinjaIDE project to that folder. I restarted NinjaIDE and boom, instantly worked.
To set the virtualenv property for your project via the GUI, go to the Project menu:
Project > Open Project Properties > Project Execution,
and you should see a variable called "Virtualenv Folder". Point that to the folder for your virtualenv, and it should work. (May need to restart NinjaIDE.) This worked for me, NinjaIDE version 2.2 under Ubuntu 12.04.
One quick note: I actually didn't use virtualenv exactly -- I had to use a "conda env," since I am using the Anaconda distribution, and apparently it is not well-tested with virtualenv yet. (I actually got a warning when I went to easy_install virtualenv. Hadn't seen that before.)
Either way, this stackoverflow question has some nice pointers to virtualenv tutorials: Comprehensive beginner's virtualenv tutorial?
Good luck!
I was having a similar problem trying to import a module from /home/paul/lib/python using the console of the Ninja-IDE. I found out that /home/paul/lib/python didn't appear in syspath when checking in the console of the Ninja-IDE. But it did in the terminal!
By starting the Ninja-IDE from the terminal, /home/paul/lib/python was in syspath when checking in the console of the Ninja-IDE. I was now able to import the module I needed.
I hope this might be of some help. If not to ebris1 than maybe to others.