I'm trying to install dlib on my raspbian and I am having a lot of problems. Well this is not real at all beacuse theoretically it's installed.
I have a virtual environment and it's installed with opencv-python, when i am in this virtual environment and I execute python if I write import dlib there is no problem. But if I run a .py file previously writted says the error
import dlib
ImportError: No module named 'dlib'
Why this is happening? I've been thinking maybe there is a conflict of versions, python2 or python3, but I don't know. In this case I'm using python 3.5.
Related
I am trying to install modules like tkinter, bs4 and numpy.
I use cmd and pip to install them, and it says that everything is installed fine.
When I am using Visual Studio code it says
ModuleNotFoundError: No module named '....'
How can I find out if Python and the modules are in the same PATH?
Or what can i do to fix that?
I've tried to reinstall Python, but I get the same error.
Is it just the VSC?
File "c:/Users/Γιώργος Μαργα/Desktop/test.py", line 1, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
pip install is most likely installing globally into a Python interpreter that is different than the one that you have selected in VS Code.
if vscode not recognize your modules try to reload vscode.
install modules with
python3 -m pip install {new_module}
and then reload your Vs code
make sure to set your Python interpreter within VSCode to the same as the one in your system path pythoninvscode
Ok so i uninstall python and installed it again but this time i checked the box that said add that to PATH or someithng like this.
I also uninstalled python from the windowsstore however when it ry to run a code in VSC it doesnt do anything
I have two python3 environments on my Ubuntu 18.04 machine.
The built-in Python environment at /usr/local/lib/python3.6/dist-packages/ and
Anaconda python3. Note: Opencv works perfectly in both of them.
The system I am building need to use sudo python3(/usr/local/lib/python3.6/dist-packages/) and python3(anaconda) at different times, but I want to minimize the dependency size for users. So what I am trying to do is that the dependencies will be installed in the built-in python3 only and when the program is called by normal python3 the script will set the sys.path to the sys.path of sudo python.(I have stored that path in a file at the installation time.)
But when I do that import cv2 raises: ModuleNotFoundError: No module named 'cv2.cv2'
Note: Other libraries works fine. Only Opencv is having this problem.
The correct way to do it was by installing OpenCV using sudo apt install python3-opencv. OpenCV installed with apt install can be used anywhere in your system whereas pip will only install OpenCV to a particular python environment.
I have installed dlib using Anaconda 3 prompt.
It has shown me that it got installed successfully. I checked through command import dlib it did not give me any error even I checked the version also it came up with 19.9.0.
But when I open my program in IDLE and run the program its showing me error
import dlib ModuleNotFoundError: No module named 'dlib'
Even from command prompt, I am getting same error.
What is the issue? I am using Python 3.6.
Installation process of dlib using anaconda3:
You have installed the package in different version of python and importing the package in other version of the python.
Package is installed. in virtual environment(3.6.8) and is being imported in standard system python (3.6.0).
So either you need to use this virtual environment for your application otherwise you will need to install the package into global system python.
Extending #Rohit's answer:
As you have installed dlib in Anaconda, you need to run the program using Anaconda prompt.
By default, IDLE and python command in command prompt use Python that is installed system wide (which is Python 3.6.0 in your case).
But to use dlib which is installed in Anaconda's virtual environment (env_dlib) you need to do:
Open Anaconda prompt.
Activate env_dlib environment: activate env_dlib
Run the Python file which uses dlib package: python FILENAME
I am setting up an anaconda environment, and I'm able to install and run all packages against the default anaconda python except for a package installed on the local system.
On the other hand, I have a locally compiled python executable that works with the problematic package, however when I run it explicitly, it can't see the packages I installed for the anaconda version of py (as expected). Is there a way to install packages against my local executable of python?
The error I'm receiving is
ImportError: /data/..../libboost_python-mt.so.1.55.0: undefined symbol: PyUnicodeUCS2_FromEncodedObject
Thanks for your help!
I worked around this by symlinking my system's python executable in the anaconda folder and installing packages against it. Still, it's a dirty fix and I had some problems with packages that worked with the default python executable.
I installed PyBrain via PyCharm and when I try to compile I get the following error:
Traceback (most recent call last):
File "C:/Users/Marcus/PycharmProjects/ANN/ann.py", line 2, in <module>
from pybrain.tools.shortcuts import buildNetwork
File "C:\Python34\lib\site-packages\pybrain\__init__.py", line 1, in <module>
from structure.__init__ import *
ImportError: No module named 'structure'
However, in the folder site-packages\pybrain\ there's a folder named 'structure' with (what I assume is) what pybrain is asking for.
I'm pretty new to Python so I'm not completely used to this installing packages thing. Is it something that I missed? I have tried to search for a package named "structure" in the PyCharm package installer but there is none (only a 'structures').
Thanks in advance
EDIT: A comment asked me to further explain how I installed the package. In PyCharm, I went to project settings -> project interpreter -> search for "pybrain"
I was having the same problem and tried all the suggestions mentioned here. Finally I realized that the version that was installing was 0.3.1, and it is not compatible with Python 3. So I deleted that version and then ran
!pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip(from Spyder ipython console). This finally worked.
I encountered the same problem.
I am working on Windows 8, 64 bit machine, with WinPython.
As every newbie would do. I install pip and then installed pybrain (or PyBrain, doesn't make difference).
After I tried to see if its working like this :
import pybrain
I got an error saying :
There is no module named "Structures".
When I checked the site-packages, it was there.
I tried the following approaches :
I tried reinstalling Structures.
I tried using pip3 instead of pip.
I tried pip3 install pybrain --upgrade
I downloaded the .zip file of the entire project from github here and after unzipping it, went inside it from cmd and did python setup.py install.
The 4th approach worked like a charm.
Cheers.
What I have done as following and it works. (windows 7, anaconda3 installed)
Download ZIP file from https://github.com/pybrain/pybrain
Extract the zip file and try python setup.py install
Open anaconda command and run conda update conda
This worked for me: pip3 install https://github.com/pybrain/pybrain/archive/0.3.3.zip
In my case was pip3, but it could be pip
I would use pip (installed with 3.4) to install packages for 3.4+. I used pip install pybrain (or maybe ... PyBrain) last summer (for someone else) and the install worked with no problem.
What is a problem is that PyBrain is a 2.x package. Fortunately, most of the incompatibilities are in the test suite (and those mostly due to using doctests). The user I installed it for ran into a few easily fixed syntax errors and is still using PyBrain for a research project.