I try to import nuurolab using this code:
import neurolab as nl
But it gives this error :
ModuleNotFoundError: No module named 'neurolab'
Then I try to install neurolab using
sudo pip3 install neurolab
Then this message shows :
Requirement already satisfied: neurolab in /usr/local/lib/python3.5/dist-packages
How to solve this problem?
You are installing the module in the wrong place. By default on Linux there are 2 integrated versions, 2.7 and 3.5 plus the one you installed. It is important not to confuse between them when installing modules or it will end up in the wrong version.
When typed in the terminal:
python brings up 2.7
python3 brings up 3.5
and for python 3.6 it will be python3.6.
pip does this as well.
pip will be for 2.7
pip3 for 3.5
and
pip3.6 for 3.6
So when installing you just have to change which environment you install it in:
sudo python3.6 -m pip install neurolab
If you get an error saying pip3.6 cannot be found, in some cases it may be pip36 otherwise you need to install pip for 3.6 using:
sudo apt install python3.6-pip
Related
In a virtual environment I get the error
path/to/python: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
when I run commands like
python -m pip install --upgrade pip
python -m pip freeze
However, when I run the same command with pip it works, e.g.
pip install --upgrade pip
pip freeze
python is the same as python3, version is 3.8.12, I reinstalled pip using
pip install --force-reinstall pip
pip version is 21.3.1.
What else can I do so the python -m pip commands work again?
Well, the problem is that a version 60.3.0 is being used, which has a bug. But you cannot install a different version of setuptools, because you have already installed version 60.3.0.
Solution: Wait for version >60.3.0
On 7 Jan 2022 Version 60.3.1 has been released, which fixed the problem in the question.
I'm trying to install the opencv module without success, I think the problem is related to the version of python I'm using.
Indeed I upgraded to the 3.9.1 version but when I'm trying to install the module, I still receive a warning referred to the old version of python I had (i.e. 2.7).
How can I get rid of this situation and successfully install the opencv library?
Error in bash
The issue is because the pip you are using in the insallation command conforms to pip2 which is used for installing packages for python2 (as is evident from the command output). You can verify the version by running:
pip --version
To solve the issue, use pip3:
sudo -H pip3 install opencv-python
If pip3 is not installed, install it via HomeBrew:
brew install python3
It should install pip3 as well. Also, have a look at this.
Today, I have decided to upgrade my software packages:
sudo apt-get upgrade
After that, I am trying to launch my python2 code and the error appears:
ImportError: No module named numpy
I have tried pip install numpy, but got a message
Requirement already satisfied: numpy in /home/user/anaconda3/lib/python3.5/site-packages (1.15.1)
pip2 install numpy produces an exception:
pkg_resources.VersionConflict: (pip 18.0 (/usr/local/lib/python3.5/dist-packages), Requirement.parse('pip==8.1.1'))
conda install numpy results in
# All requested packages already installed.
which python gives me
/home/user/anaconda3/bin/python
which pip results in
/home/user/anaconda3/bin/pip
What could be the problem? Seems like numpy cannot be installed for python2 because it is already installed for python3. I suppose, something went wrong with python2 vs python3 linkage in conda? Is it a problem with python, numpy, pip, conda or environments?
I installed Anaconda Python on my machine. When I start the Python Interpreter and type "import caffe" in the Python shell, I get the following error:
ImportError: No module named google.protobuf.internal
I have the following files:
wire_format_lite_inl.h
wire_format_lite.h
wire_format.h
unknown_field_set.h
text_format.h
service.h
repeated_field.h
reflection_ops.h
message_lite.h
message.h
generated_message_util.h
extension_set.h
descriptor.proto
descriptor.h
generated_message_reflection.h
generated_enum_reflection.h
dynamic_message.h
descriptor.pb.h
descriptor_database.h
What files do I need so the import will work? Is there an "internal.h" file that is required?
This is probably because you have two python environments in your machine, the one provided by your linux distribution(pip) and the other by the anaconda environment (/home/username/anaconda2/bin/pip).
Try installing protobuf for both environments to be sure
pip install protobuf
/home/username/anaconda2/bin/pip install protobuf
If you are using Anaconda, do conda install protobuf
If you are using Ubuntu, try installing protobuf using
sudo apt-get install protobuf
It solved the same problem that I faced.
Easiest way to fix it:
pip install grpcio
pip install protobuf
When have multiple python version use: as suggested by aimuch.
/usr/local/bin/pip2 install protobuf
/usr/local/bin/pip2 install grpcio
This is because the python envirnment confusion.
# check where pip2
$ where pip2
/usr/local/bin/pip2
/usr/bin/pip2
# check where pip
$ which pip
/usr/local/bin/pip
On my computer, I have two pip2(I install caffe using python2 env), so I used /usr/local/bin/pip2 install protobuf solved this problem.
/usr/local/bin/pip2 install protobuf
First of all I'm new to python and using 3.5 version when trying to install pandas usingpip install pandasit is showing error as pip is not recognized as an internal or external command by using other command to install some packages,py -3.5 -m pip install SomePackageit shows me error could not find a version that satisfies the requirement SomePackage also ask's me update the pip version from 7.1.2 to 8.1.0 and when updating the pip python -m pip install --upgrade pip it shows me error python is not recognized as an internal or external command
Now how to install Pandas on my python 3.5?
You should try typing in python3 instead of python because, you are running v3.x on Python and the command python runs v2.7 according to me.