The code I am trying to run is
import graph_nets as gn
and the compiler returns
ImportError: cannot import name 'Sonnet' from 'graphs'
which traces back to a line in the sonnet package that says from graphs import Sonnet, D3Graph, MatplotGraph
(I have seen many similar errors on forums and the common solution is
pip uninstall sonnet
pip install dm-sonnet
but this doesn't work for me as pip install dm-sonnet is responded with requirement already satisfied and uninstalling sonnet makes the compiler return
module 'sonnet' has no attribute '__version__'
for the same line of code I am trying to run)
The there other possible solutions?
AFAIU the correct package you need is dm-sonnet. But you have already installed sonnet. Now you need to reinstall dm-sonnet to remove remnants of sonnet and install dm-sonnet afresh.
pip uninstall -y dm-sonnet
pip install dm-sonnet
Or simply
pip install --ignore-installed dm-sonnet
To use dm-sonnet you need tensorflow. dm-sonnet doesn't automatically install tensorflow as a dependency so you need to install it yourself:
pip install tensorflow
Related
Is there any way to force install a pip python package ignoring all it's dependencies that cannot be satisfied?
(I don't care how "wrong" it is to do so, I just need to do it, any logic and reasoning aside...)
pip has a --no-dependencies switch. You should use that.
For more information, run pip install -h, where you'll see this line:
--no-deps, --no-dependencies
Ignore package dependencies
Try the following:
pip install --no-deps <LIB_NAME>
or
pip install --no-dependencies <LIB_NAME>
or
pip install --no-deps -r requirements.txt
or
pip install --no-dependencies -r requirements.txt
When I was trying install librosa package with pip (pip install librosa), this error appeared:
ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I tried to remove llvmlite, but pip uninstall could not remove it. So, I used capability of ignore of pip by this code:
pip install librosa --ignore-installed llvmlite
Indeed, you can use this rule for ignoring a package you don't want to consider:
pip install {package you want to install} --ignore-installed {installed package you don't want to consider}
I want to run an algorithm written in Python on my Ubuntu virtual machine. It needs to import the hdbscan module. I thus want to install it on my virtual machine.
Following the documentationfrom Pypi.org about this library, I simply ran :
pip install hdbscan
After a few minutes, it returned :
Succesfully built hdbscan
Installing collected packages: hdbscan
Succesfully installed hdbscan-0.8.27
However, if I run my algorithm, it still says that there's "No module named 'hdbscan'".
I tried pip uninstall hdbscan but it then returns :
WARNING : Skipping hdbscan as it is not installed.
I have tried several commands to fix this issue, like for example
sudo apt --reinstall install hdbscan
or
pip install --upgrade git+https://github.com/scikit-learn-contrib/hdbscan.git#egg=hdbscan
All I get as a result is "successfully installed" or "requirement already satisfied" but my algorithm still can't use it, "is not installed" or "unable to locate package hdbscan" alternatively as I try one command or another.
I don't know what is the cause of the problem nor how to fix it. Can anyone help me please ?
try this in your terminal
conda install -c conda-forge hdbscan
I had the same problem using Windows. I fixed it installing the various dependencies before and then hdbscan out of any environment.
I strictly recommend to run the terminal as administrator, otherwise some dependencies cannot be solved.
conda install cython
conda install numpy scipy
conda install scikit-learn
pip install hdbscan
I am getting the following error when using import cv2:
ModuleNotFoundError: No module named 'cv2'
My version of Python is 3.6 64 bit. I have downloaded the whl file to install it via pip manually, and have also installed it with pip install opencv-python however I still get ModuleNotFoundError.
pip outputs Requirement already satisfied: opencv-python in c:\...\python36\site-packages
Help would be much appreciated.
Your download must have been corrupted. It happened to me too. Simply uninstall the package and use
sudo apt-get install python open-cv
Use pip install -U opencv-python
I installed pymc3 from pip and was going through getting started
http://pymc-devs.github.io/pymc3/notebooks/getting_started.html
Towards the end they use GLM -
from pymc3.glm import GLM
Which returns error "ImportError: cannot import name GLM"
I am able to import other modules of pymc3.glm. For eg this works-
from pymc3.glm import families
install the module with pip3
sudo pip3 install git+https://github.com/pymc-devs/pymc3
use python 3
then it should be fine
Try updating your pip once through :
pip install --upgrade pip
or
python -m pip install --upgrade pip
Even if doesn't solve the problem, there might be some problem with the module's version for 3+. In this case, try to go back to a stable 2.7 version.
I tried to install sci-kit learn module in python on ubuntu. As explained in their tutorial, I did:
pip install --user --install-option="--prefix=" -U scikit-learn
But when, in python console, I try
import sklearn
I get:
ImportError: No module named sklearn
Moreover, if I do
pip list
sklearn does not appear in the list.
And if I try:
sudo pip install scikit-learn
I get:
Requirement already satisfied (use --upgrade to upgrade): scikit-learn in ./.local/lib/python2.7/site-packages
It's probably caused by the folder ~/.local/lib not appearing in your sys.path. You can update the sys.path in a couple of ways. Either set the PYTHONPATH environment variable before running the console, or just append to the sys.path array.
You could uninstall the module and then reinstall as root:
pip uninstall scikit-learn ; sudo pip install scikit-learn
You can also just delete the ~/.local/lib folder and reinstall the package.
I had the same problem, but when I used sudo pip uninstall scikit-learn or sudo pip install -U scikit-learn I'm dealing with the following error:
Cannot uninstall 'scikit-learn'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
My problem solved by the following line:
sudo pip install --ignore-installed scikit-learn==0.18