Hi
in jupyter notebook, when i tried to import tensorflow like below, i got an error of ModuleNotFoundError: No module named 'tensorflow'. Then, I opened anaconda prompt and trying to install tensorflow in anaconda and it failed many times and here is the error message. Could you please help me what is the problem? Thanks
import tensorflow as tf
ok, so i tried to downgrade python from 3.8 to 3.6 and i still got an error at the end, could anyone help pls? Thanks
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:\ProgramData\Anaconda3
According to TensorFlow docs, tf is compatible with python 3.5, 3.6, 3.7 or 3.8
and also python 3 64bit release is a must, so it's maybe worth to check if you don't try to install tf accidentally on 32bit version of python.
https://www.tensorflow.org/install/pip#windows
import sys
print(sys.version)
I installed tf according to Anaconda docs:
create fresh env,
activate it,
and install tf:
conda create -n myproject tensorflow
conda activate myproject
conda install tensorflow
I can see that conda automatically selected python version 3.7.9
verify:
import tensorflow as tf
tf.version.VERSION
your python version is not compatible with this version of tensorflow. you are using python 3.8 downgrade python to either 3.5, 3.6 or 3.7. downgrading python should solve your issue.
Related
I downloaded anaconda which has a python 3.8 version. and i installed tensorflow with pip install tensorflow.
from tensorflow.contrib import learn in my code did not work as tensorflow 1.x doesnt work in python 3.8.
I downgraded to python 3.7 by conda install python==3.7. and then pip install tensorflow==1.15. But it still did not work and errors came up -- regarding python version still being 3.8 inside python.exe.
How can I go about it? Is there an alternate way to install? Please help. Thank you
You can download tensorflow1.X from https://pypi.org/
For example tensorflow1.15.0. Select the whl file corresponding to your system.
Then use pip install path/tensorflow-1.15.0-XXXX.whl or
conda install path/tensorflow-1.15.0-XXXX.whl to install.
I am trying to use BERT with bert-serving-start in python3.8 but it does not initialise and throws error:
TypeError: cannot unpack non-iterable NoneType object
This may have something to do with the path not being recognised but I followed the instructions as follows: https://github.com/hanxiao/bert-as-service#install
My folder is unzipped and entire model path is:
C:\Users\g\PycharmProjects\Project1\cased_L-12_H-768_A-12\cased_L-12_H-768_A-12
This occurs when running this in the command line as instructed.
bert-serving-start
-model_dir \Users\g\PycharmProjects\Project1\cased_L-12_H-768_A-12\cased_L-12_H-768_A-12 -num_worker=1
I don't know if this is a bug to report as it does say untested with the current Tensorflow but it may just be a mistake I made.
Was hoping someone could double check it's not me before submitting a bug report.
Short Answer
You are using too new a version of Tensorflow. BERT-as-a-Service works only with a TF version between 1.10.0 and 1.15.0. Once you install the old version of Tensorflow, this error would go away. Also, use the absolute path, instead of relative path for the model_dir directory.
Long Answer
If you are on the latest version of Python and hence pip, you wouldn't be able to get TF 1.x versions. Currently TF 2.3.0 is out there. The oldest version of TF pip can get for you is 2.1.0cr1. But you can do the following to get say v1.15.0 of Tensorflow:
Create a virtual environment with Python v3.7.6 that comes with old version of pip.
Activate the new virtual environment.
Install v1.15.0 of Tensorflow
Install Bert server in this virtual environment.
Start the Bert server
You don't have to install bert client in this virtual environment. You can continue using the bert client in the base environment. It will still work.
conda create -n test python=3.7.6
conda activate test
pip install tensorflow==1.15.0
pip install bert-serving-server
bert-serving-start -model_dir C:\Users\VHS\uncased_L-12_H-768_A-12\ -num_worker=2
I got this error with various versions including 1.15.0, 1.15.2, 1.15,3 but found it worked with 1.14.0, 1.15.4 and 1.15.5 when upgrading incrementally
Adding to the answer by #VHS, the following works (using tensorflow 1.13.0rc1).
conda create -n test python=3.7.6
conda activate test
pip install tensorflow==1.13.0rc1
pip install bert-serving-server
bert-serving-start -model_dir /path/to/pretrained/bert/uncased_L-12_H-768_A-12/ -num_worker=4
For me, installing frash env with tensorflow 1.11.0 did the trick,
also in the doc's https://github.com/google-research/bert it state they used 1.11.0
python 3.7.3 and tensorflow 1.15.0 works for me. be careful about the numpy version, my version is 1.18, too advanced will cause the same error
I'm using anaconda ver 3, and I have installed python as well separately from anaconda. I installed python ver 2.7 and ver 3.6 from python website.
Now, I have installed keras from anaconda command prompt by using conda install keras. However, when I open jupyter notebook and write :
import keras
it says :
no module named keras
I also tried importing tensorflow but it gave me the same error
As far as i know, keras is a version of tensorflow. You should try installing tensorflow instead and then run
import tensorflow as tf
tf.__version__
if you get '2.1.0' or any 2., you should be all set!
EDIT1: Keras is part of tensorflow not a version (as pointed out in the comments).
EDIT2: The link below gives good details on environments activation/creation.
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
Okay so what I did is first updated anaconda by using :
conda update conda
and then I installed python :
conda install python=3.7
and finally I installed keras again :
conda install keras
And now I can import both packages of keras and tenserflow
I can't get tensorflow to work on two different Windows PCs and on both I get "ModuleNotFoundError: No module named 'tensorflow' when try to import them in python.
Numpy for example works on one machine not the other. Checked a dozen of posts on stackoverflow, nothing really helps. Clearly somethings wrong with the paths, can't really figure out what and how to trouble check it. I followed this set-up https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Installation-Windows.md
I need the 1.7.1 version of TF for Unity ML-agents to work
OS: windows 10
conda version : 4.4.11
conda-build version : 3.4.1
python version : 3.6.4.final.0
Even a clean install of Anaconda didn't help.
I finally managed to fix this (not with ML-agents, but that's a different story). I uninstalled Anaconda and Python as well as cleared the registry from all Python information. I had a previous installation of Python 3.7 and I'm guessing this might have caused some issues. Clean install of Anaconda with a 3.6 env and TF is working both with cpu and gpu support.
These problems often happen when you are on the wrong environment, or when you do not activate your environment. Please try the following steps and see if the problem persists:
Open Anaconda prompt
Activate the environment in which you installed tensorflow by using conda activate YOUR_ENV_NAME
Type python to launch python
try to import tensorflow
And see if the error persists.
Hi I'm trying running an tensorflow application in my computer.
I installed the tf , using the pip and follow the steps in the tensorflows documentation.
I'm using python 3.6.3 in ubuntu 17.10
KeyError: "Couldn't find field google.protobuf.EnumDescriptorProto.EnumReservedRange.start"
Tks
I get this error when I try to use TensorFlow with Anaconda rather than Python 2.7 on a Mac. To see if you are using Anaconda, use the which command:
which python
/Users/me/anaconda2/bin/python
If this is causing your problem, the solution is to install Tensorflow in a virtual environment:
export PATH=/usr/local/bin:/usr/bin:$PATH which python
/usr/bin/python
cd
virtualenv tf
source ~/tf/bin/activate
pip install tensorflow
To use tensorflow in the future, remember that you must first activate the venv (source ~/tf/bin/activate.)