I know this question has been asked before but I have not been able to fix the issue with the responses, hence posting this one.
I get this error :
ModuleNotFoundError: No module named 'keras'
when I import keras.
1) I created a new env ( python 3.5 ) and insatlled tensorflow,theano and keras.
2) I can see the package Keras when I list the packages in this env
3) I tried uninstalling and then install Keras back ( using pip3 as well , as suggested in another forum)
4) I can see keras folder under /site-packages
Not sure what I should be doing to get it to work. TIA.
I ran into this issue on a windows laptop. the other answer didn't help me... here's what I did to get it working:
first I had to stop using cygwin. the various commands are a bit wonky unless you are using cmd.exe.
second, I read this article and follow the instructions to essentially install Jupyter within the env I wanted it to play with.
https://www.quora.com/How-can-I-work-with-Keras-on-a-Jupyter-notebook-using-Tensorflow-as-backend
hopefully this will help someone!
Related
I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
The second time I tried to import it (using a different notebook) I got:
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (C:\python-environments\nlp\lib\site-packages\thinc\api.py)
So I tried to restart the kernel and tried it again (thinking that might be the issue). That did not solve it. Also trying to run the same cell that imported Spacy in the first notebook also throws the error now after it went well the first time.
It sounds like you have an old version of Thinc somewhere; try uninstalling and reinstalling Thinc.
Another thing to check is if you're running in the right Python environment. Sometimes Jupyter notebooks pull in a different environment than the one you're expecting in non-obvious ways. There was a thread in spaCy discussions about this recently. You can run this command to check which Python executable is being used in the notebook and make sure it's the one you think it is:
import sys
print(sys.executable)
I had a similar issue, followed the git hub link, created a new environment, and installed all required packages, and it resolved my issue. I'm using Visual code, so I had to install other dependencies since VC uses this as a conda environment as a base for my code implementation
I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
The second time I tried to import it (using a different notebook) I got:
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (C:\python-environments\nlp\lib\site-packages\thinc\api.py)
So I tried to restart the kernel and tried it again (thinking that might be the issue). That did not solve it. Also trying to run the same cell that imported Spacy in the first notebook also throws the error now after it went well the first time.
It sounds like you have an old version of Thinc somewhere; try uninstalling and reinstalling Thinc.
Another thing to check is if you're running in the right Python environment. Sometimes Jupyter notebooks pull in a different environment than the one you're expecting in non-obvious ways. There was a thread in spaCy discussions about this recently. You can run this command to check which Python executable is being used in the notebook and make sure it's the one you think it is:
import sys
print(sys.executable)
I had a similar issue, followed the git hub link, created a new environment, and installed all required packages, and it resolved my issue. I'm using Visual code, so I had to install other dependencies since VC uses this as a conda environment as a base for my code implementation
I have seen TensorFlow installation issues many times on this site. I have tried most of the fixes that I've come across, but none of them have quite worked.
Technical information:
Windows 10, 64 bit
Python version: Python 3.6
PyCharm
Current conda virtual environment: tensorflow_env, with interpreter as "Python 3.6 (tensorflow_env) (2) C:\Users\username\Anaconda3\envs\tensorflow_env\pythonw.exe"
Please let me know if I'm missing any important information, so I can add it.
Description of the issue:
In PyCharm, I have the code "import tensorflow" which results in the error mentioned in the title.
Now, when I start typing "import tens" it auto-completes to "import tensorflow" for me (see the figure below), which makes me think that it sees the module in some way, but it just can't import for some reason.
Additionally, my project interpreter has tensorflow as a listed package (see the figure below).
In order to install tensorflow, I have tried a number of methods. Here are some of them.
pip install tensorflow (resulted in "successful installation of . . .")
pip3 install tensorflow (resulted in "successful installation of . . .")
A number of ways of upgrading tensorflow (e.g. pip upgrade), most of which have resulted in success messages.
Through the interpreter itself, resulting in the following image (note the "Package 'tensorflow installed correctly" message at the bottom.
Now that all being said, I can technically import tensorflow using the command prompt and the following commands.
conda activate tensorflow_env
python
import tensorflow (does not result in error)
import keras (results in "Using TensorFlow backend.")
However, I would like to use this outside the command prompt.
I've tried a few Youtube tutorials (most notably tech with tim's video on the subject, as well as his troubleshooting video), the instructions on the tensorflow website, removing every version of python from my computer and trying again (twice), and the instructions I've seen on other posts on stackoverflow.
I'm certain I'm just missing something simple and obvious, but I need some help figuring out what that is.
I appreciate it. Thanks!
I have been trying to intall scikit-learn and pytorch using their respective commands given in the docs:
The commands for installing PyTorch are:
1) pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
2) pip3 install torchvision
The command for installing scikit-learn is:
pip install -U scikit-learn
Some background:
I am using Windows 8.1, Python 3.7.2. My pip is updated. I have also installed Anaconda for solving this using conda, but had zero luck!(Also, here I am running into 'conda' unrecognized error which is another story). Here are the paths my PATH variable holds.
PATH
C:\Users\satya\Anaconda3;
C:\Users\satya\Anaconda3\Library\mingw-w64\bin;
C:\Users\satya\Anaconda3\Library\usr\bin;
C:\Users\satya\Anaconda3\Library\bin;
C:\Users\satya\Anaconda3\Scripts;
C:\Users\satya\AppData\Local\Programs\Python\Python37\Scripts\;
C:\Users\satya\AppData\Local\Programs\Python\Python37\; C:\Users\satya\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.7
The Actual Problem:
The same commands for installation given above work perfectly fine on my other Windows 10, but, for my Windows 8.1 it gives this error which has become a real PITA
Import Error: DLL load failed The specified module could not be found
When I import sklearn or import torch I get the exact same error. All the time.
Back Story:
I have searched almost all the related questions I could find on Stackoverflow and Github for 6+ hours to help me solve this problem. But, none of the answers have helped till now and some haven't had an "understandable" answer. Maybe, its just a small fix, but now, I am choosing to post a question on SO.
My Question Again:
Can someone please help out and try to explain what I am missing out here? I really want to fix this error for good(and want to be in a position to fix it if I encounter it again). An elaborate answer would really help understand easily.
Thank You!
Please check your python build number with the following command.
conda list python
Python 3.7.2 with build number h8c8aaf0_2 has a solved issue.
If this is the case, an update will do.
conda update python
I keep getting this error while trying to import pytorch in jupyter notebook
import torch
AttributeError: function 'AddDllDirectory' not found
this error occur only when I try installing pytorch in anaconda (I used both command to install pytorch pip and conda, I also tried installing only the cpu version and nothing changed, i still get the same error while trying to import it)
I searched the internet and found nothing remotely close to my problem.
is there's a way I can fix this error?
thanks in advance
I fixed the issue by installing the file (KB2533623) from
Here (for windows 7 users). this file apparently contains the missing "AddDllDirectory" function.
Posting this answe in case someone ran into the same problem.