When I try to import the hmmlearn package with import hmmlearn, I get this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-9-036832e0c673> in <module>
----> 1 import hmmlearn
~\Anaconda3\envs\py385\lib\site-packages\hmmlearn\__init__.py in <module>
9 try:
10 import setuptools_scm
---> 11 __version__ = setuptools_scm.get_version( # xref setup.py
12 root="../..", relative_to=__file__,
13 version_scheme="post-release", local_scheme="node-and-date")
AttributeError: module 'setuptools_scm' has no attribute 'get_version'
I'm in a python 3.8.5 env on a windows machine. In other environments on this machine (e.g. py 3.7) I don't get the error. Also on my MacOs machine in an 3.8.5 env I can import the package without any problems. In all cases I used pip install hmmlearn to get the package.
I uninstalled and re-installed the hmmlearn and the setuptools_scm package, but that didn't fix it.
It seems like the is a problem with my setuptools_scm package. How can this be fixed? Is there a way to completely remove the hmm package and all its dependencies and do a "clean" re-install?
I had the same problem on Windows and python 3.8.5. For me, uninstalling the hmmlearn and setuptools_scm and then reinstalling it with conda (I'm in a conda environment) fixed it.
So I did:
pip uninstall hmmlearn
pip uninstall setuptools_scm
and then
conda install -c conda-forge setuptools_scm
conda install -c conda-forge hmmlearn
Also, I restarted the kernel in jupyter notebook.
But I'm not sure if that was really the problem, since I can't recreate the problem by uninstalling it over conda and reinstalling the packages over pip.
For me the solution was
pip uninstall hmmlearn
pip uninstall setuptools_scm
and then simply,
pip install hmmlearn
pip install setuptools_scm
and Kernel restart.
System setup:
Windows 10 Pro
Python 3.7.4 on conda 4.11.0
Related
I have a tensorflow 2.2 conda environment setup with python 3.8.2 on Ubuntu.
I ran pip install tensorflow-io==0.14.0.
When I try to
import tensorflow-io as tfio
I get the erorr:
File "/home/somedir/miniconda3/envs/env_name/lib/python3.8/site-packages/tensorflow_io/core/python/ops/__init__.py", line 65, in _load_library
raise NotImplementedError(
NotImplementedError: unable to open file: libtensorflow_io.so, from paths: ['/home/somedir/miniconda3/envs/env_name/lib/python3.8/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so']
caused by: ['/home/somedir/miniconda3/envs/env_name/lib/python3.8/site-packages/tensorflow_io/core/python/ops/libtensorflow_io.so undefined symbol:
_ZN10tensorflow0pKernel11TraceStringEPNS_150pKernelContextEb']
What's the issue and how can I fix it?
As #Smedegaard mentioned, tensorflow_io is not on conda forge. The answer of vlasenkoalexey on Github issues to tackle this:
Obvious workaround is to uninstall tensorflow and tensorflow-io and install them from pip:
pip uninstall tensorflow
pip uninstall tensorflow-io
pip install tensorflow-gpu
pip install --no-deps tensorflow-io
I got the same error in a Jupyter lab, running in a conda environment.
Looks like tensorflow_io is not on conda forge yet: https://github.com/tensorflow/io/issues/676
If possible you can change to a regular Python environment.
Solution:
!pip install tensorflow_io==0.17.1
!pip install tensorflow==2.4.0
at 19 oct 2022, it is work with that versions
#!pip install tensorflow==2.8.0
#or
!pip install tensorflow-gpu==2.8.0
import tensorflow as tf
!pip install tensorflow-io==0.25.0 # что сломалось с ==0.26.0
Have you tried pip install tensorflow-io==0.13.0 ?
according to This TF has 2 version of TF io that can be compatibly installed with.
Running on MacOS, Catalina.
Other Details:
Jupyter Notebook
!pip install --no-deps keras==2.2.4
!pip install --no-deps tensorflow==1.15.3
Python Version 3.7
Following virtually step-by-step from: https://machinelearningmastery.com/how-to-train-an-object-detection-model-with-keras/
Anyone encounter this error / know how to resolve?
Resolved by restarting Jupyter Notebook kernel. Consulted various resources online to install / uninstall packages and items, so difficult to pinpoint was produced the desired result -- but for those encountering this, ensure to restart kernel.
On Windows, in my Anaconda virtual environment running Python 3.7, I have fixed this issue by simply upgrading TensorFlow and Keras to the latest versions.
I did this by running the following PIP command in my Anaconda terminal:
pip install tensorflow --user --upgrade
pip install keras --user --upgrade
I use Jupyter Notebook with a virtual environment.
I have a dependency installed, but can't import it:
cell 1:
!pip3 install sent2vec
Requirement already satisfied: sent2vec in
venv/lib/python3.7/site-packages (0.0.0)
cell 2:
import sent2vec
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-5-06231d291a17> in <module>
----> 1 import sent2vec
ModuleNotFoundError: No module named 'sent2vec'
How this can happen? How to fix this?
> pip3 list
Package Version
------------ ---------
certifi 2019.9.11
chardet 3.0.4
Cython 0.29.14
idna 2.8
joblib 0.14.0
langdetect 1.0.7
nltk 3.4.4
numpy 1.17.1
pip 19.3.1
requests 2.22.0
scikit-learn 0.21.3
scipy 1.3.2
sent2vec 0.0.0
setuptools 41.6.0
six 1.13.0
urllib3 1.25.7
wheel 0.33.6
You'll note that jupyter is not listed in your installed packages. That means you're running it from a different virtual environment. As I mentioned in the comment responding to your question, you can run which jupyter to find out where your Jupyter Notebook application is being run from (assuming you're on a *NIX system); in this case, it won't be from the python3.7 virtual environment that shows up in your first code block.
To resolve the issue, you simply need to run pip3 install jupyter, then retry running jupyter notebook.
Alternatively, you can add your virtual environment as a kernel so that it can be selected when you're running Jupyter from your original environment. To do this, you would run (assuming pip is connected to your original environment):
pip install ipykernel
ipython kernel install --user --name=<insert name of your venv>
You should then be able to select that venv as a kernel on new notebooks. (Source for info on venv activation in Jupyter).
Try by installing directly within Jupyter using the following command:
import sys
!{sys.executable} -m pip install your_package_name
Run this (with envname your enviroment name):
jupyter kernelspec uninstall envname
ipython kernel install --user --name=envname
Sometimes Jupyter doesnt update properly the kernels associated with enviroments.
So the solution is to uninstall it and install it again.
I had the same problem and this fixed it
It apears that you need Numpy 1.17.1(you have Numpy 1.16.0) to use sent2vec
requirements https://github.com/epfml/sent2vec/blob/master/requirements.txt
Can someone explain how to install Prophet on Python3?
I tried pip install fbprophet but it did not work.
Tried to do this in the notebook after importing pandas and sklearn and got another error:
import pandas as pd
import sklearn as sk
from fbprophet import Prophet
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-f503e9c6cf11> in <module>()
----> 1 from fbprophet import Prophet
ModuleNotFoundError: No module named 'fbprophet'
First you have to Install c++ compiler, you can install c++ compiler with below command -
conda install libpython m2w64-toolchain -c msys2
Once c++ compiler installed you have to install pystan, to install pystan you can use below command
pip install pystan
Finally, now we are ready to install facebook prophet -
pip install fbprophet
Hope this is helpful..
For more details follow this link -
https://facebook.github.io/prophet/docs/installation.html
Easiest way is to install fbprophet :
conda install -c conda-forge fbprophet
This will download all the needed packages first.
Then ->
conda install -c conda-forge/label/cf201901 fbprophet
Try installing fbprophet
pip install fbprophet
Or
pip3 install fbprophet
I had relatively similar problem, but my error was it couldn't import pystan which in installed using pip install pystan. so the problem was fbprophet doesn't support latest version of pystan so uninstall previous one and install older version of pystan.
pip install pystan==2.19.1.1
pip install fbprophet
https://facebook.github.io/prophet/docs/installation.html
On Windows it's easier using anaconda or miniconda, just give
conda install pystan
and it will install all the needed dependencies, included the c++ compiler, then
pip install fbprophet
in Linux systems, for example, ubuntu, a simple
pip install pystan
pip install fbprophet
should work, without installing anaconda/miniconda
!pip install pystan==2.19.1.1 fbprophet ##### i was trying to install fbprophet==0.7.1 but in the presence of cmdstanpy==0.9.5 it was unable to build the wheel for fbprophet.
after executing the above command for installing pystan==2.19.1.1 collectively with fbprophet successfully installed cmdstanpy-0.9.5 fbprophet-0.7.1 note that there is no version specified for fbprophet in the command and pystan is specified with version 2.19.1.1 to avoid dependency conflicts.
This worked for me. pip3 was a must!
pip3 install pystan
pip3 install fbprophet
I'm using Anaconda Python 2.7 on windows 10
I was planning on doing Keras visualization so (whilst spyder was open) I opened the Anaconda command prompt and pip installed graphviz and pydot. Now when I try run the following:
from keras.models import Sequential
or any sort of "from keras." , I get the error:
ImportError: cannot import name gof
I have uninstalled and reinstalled Keras, Graphviz and pydot. i am using the development version of theano. I cannot find a fix.
P.S
If I uninstall graphviz and pydot, keras works again
EDIT
After uninstalling anaconda and reinstalling it including theano, keras, graphviz and pydot I now get the following error:
from keras.utils.visualize_util import plot
Using Theano backend.
Using gpu device 0: GeForce GTX 970M (CNMeM is disabled, cuDNN not available)
Traceback (most recent call last):
File "<ipython-input-1-65016ddab3cd>", line 1, in <module>
from keras.utils.visualize_util import plot
File "C:\Anaconda2\lib\site-packages\keras\utils\visualize_util.py", line 8, in <module>
raise RuntimeError('Failed to import pydot. You must install pydot'
RuntimeError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
I used pip install graphviz and pip install git+https://github.com/nlhepler/pydot.git
The error message is a bit misleading, as you can see here. The problem is that graphviz is not installed.
But you mention that graphviz was installed using pip. This is also misleading, since that graphviz package is just a python wrapper, and the graphviz binaries have to be installed separately for the python wrapper to work.
If you are using an Anaconda environment, you'd better install pydotplus and graphviz via conda install.
conda install graphviz
conda install pydotplus
Note:
You'd better update your Keras to the newest version (2.0.9+), it can automatically check and choose which one of pydotplus,pydot-ng,pydot to be used. pydot-ng has been unmaintained for a long time, and it only supports py3.4- and py2.7.
What I did is followed.
import keras
import pydotplus
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pydot
plot_model(your_model_name, to_file='model.png')
That's worked for me.
On mac Anaconda python=3.6.8
Keras 2.0.6 looks for pydot-ng (better maintained) and then if it's not found, falls back on pydot. I resolved this issue by installing pydot-ng from source.
I had the same problem. I am using Anaconda python on Ubuntu. but it seems that Keras uses system's python not the Anaconda python. Initially, I installed pydot and graphviz using conda. When I installed pydot and graphviz in system's python(using /usr/bin/pip install pydot) it worked fine.
Install graphviz by brew in osx brew install graphviz, for ubuntu use apt-get install graphviz, do not need to install graphviz by pip.
I had similar problem with my Keras (without anaconda). I have solved my problem using this way
sudo pip install pydot
sudo pip install graphviz
sudo add-apt-repository ppa:gviz-adm/graphviz-dev
sudo apt-get update
sudo apt-get install graphviz-dev
1)Conda install graphviz
2)pip install graphviz
3)pip install pydot
then:
import os
os.environ["PATH"] += os.pathsep + AppData\\Local\\Continuum\\anaconda3\\envs\\tensorflow\\Library\\bin\\graphviz'
For Anaconda on Mac:
To install this package with conda run:
conda install -c anaconda graphviz
Install graphviz to the system. Download the package from here, or on Mac:
brew install graphviz
Install python pydot-ng and graphviz wrapper.
pip install pydot-ng graphviz
conda install -c anaconda pydot-ng #Anaconda user
Use pydot-ng in your code
import pydot_ng as pydot
If Keras visualization utils still uses pydot, try to change import pydot to import pydot_ng as pydot in visualize_util.py
The below works inside a jupyter notebook runing in a jupyter/tensorflow-notebook docker container.
!conda install -y graphviz pydotplus
import pydotplus
import keras.utils
keras.utils.vis_utils.pydot = pydotplus
keras.utils.plot_model(your_model_name, to_file='model.png', show_shapes=True)
You need to tell keras to use pydotplus
it is nothing related to pydot or graphviz if you have installed via pip.
You should go download graphviz brinary and install.
Don't forget adding the bin folder into your PATH: C:/Program Files (x86)/Graphviz2.38/bin/
And after that to close and reopen your console.
After installing pydot and graphviz and adding graphviz to the path, you can restart the IDE or terminal. see here.