No module named 'tensorflow' with GCP - python

When trying to execute a gcloud ai-platform local train command with python 3.7 files, I get an error like:
No module named 'tensorflow'
This can happen also with numpy, even though both of these libraries are correctly installed. Is there a different installation path for libraries in Google Cloud? I am actually a newbie with GCP and I have no idea of what may be causing this problem. I am working on a Mac and Google SDK is, I guess, correctly installed.
Thanks
error

Naming conventions of packages and modules are expected to be lowercase.
import tensorflow as tf
I suspect the same issue arises with numpy - where you are incorrectly writing import TensorFlow or import Numpy

There is an environment variable named CLOUDSDK_PYTHON that must be set to "python3.x".
My error was caused by GCP using python2, and so not recognizing certain packages.

Related

hebpipe library incompatible with colab

missing modules lib and crfutils.
I am trying to write some nlp using hebpipe library in colab.
After using !pip install hebpipe i get the message that it was indeed successfully installed and even checked if it was indeed installed using: !pip list -v .
the problem is when trying to import the library it seems to be missing the dependancy:
ModuleNotFoundError: No module named 'hebpipe.lib.crfutils'
as well as:
No module named 'lib'
does anyone know a way to fix this? or should i just try a different environment?

Unresolved reference for some library classes of Cerberus in PyCharm

I started running into an import issue where PyCharm is unable to resolve references to classes for some libraries I have installed. I haven't run into this issue for any standard libraries.
from cerberus import Validator used to work but stopped working along with the other reference issues.
I have tried:
File > Invalidate Caches / Restart
Using a difference Anaconda env
Re-installing library

Issue importing Google Neuroglancer Package

I am using Google's Neuroglancer which I downloaded from GitHub and trying to run an example script provided by them. However, one of the lines is import neuroglancer, and since I cloned the whole repo there is a neuroglancer folder with all of the required files, but I am getting the following error:
ImportError: No module named 'neuroglancer'
Is there any way I could fix this? I don't see the issue since neuroglancer is in the same file path as the python script.
In case you are running the example in the neuroglancer project try following their guide.
Otherwise you might want to try and installing the Neuroglancer package using something like pip and a virtual environment to be able to import the package into the project.

errors with import library in Anaconda

I am facing a strange error. I have installed pyrenn module with pip install in conda environment and solved an ANN problem successfully. But when I restarted the kernel in jupyter or spyder, I am not able to even import the module which shows error: module 'pyrenn' has no attribute 'CreateNN'. But it definitely has the module and it worked last time.
what may be the possible problem?
If you look at your screenshot it shows a path ~/ANN study/pyrenn/pyrenn.py. So not only you are creating a conflicting folder name pyrenn you are also creating a conflicting importable file pyrenn.py.
Follow the thumb rule of not naming the folders and your files which conflict with modules that you will uses or are existing.

TensorFlow with Eclipse

I'm trying to run the TensorFlow Python examples for with Eclipse Mars for Mac OS X, but I'm getting the following error:
Unresolved import: tensorflow.python.platform
The error is raised on the 3rd line:
from __future__ import absolute_import
from __future__ import print_function
import tensorflow.python.platform
I'm new to Python and TensorFlow. I'm using PyDev for Eclipse. I read somewhere that I can add code to the "External Libraries" folder but I'm not sure where the TensorFlow library is.
I installed TensorFlow following the installation directions on the TensorFlow website.
What am I missing?
It sounds like you are running into a problem with your Python environment. The easiest way to deal with this is to follow these steps:
Install TensorFlow into a virtualenv, by following the instructions here. This avoids the need to acquire root privileges, and makes it easier to experiment with different versions of TensorFlow. (It also avoids conflicts with other system-installed versions of different libraries.)
Set up PyDev to use your new virtualenv, by following step 5 onwards in this guide. This involves setting up a new "interpreter" whose library will be the set of libraries in the virtualenv. You may need to recreate your Eclipse project to use this interpreter.
install tensorflow.
in eclipse , assume you have pydev installed, go to preferences>pydev>python interpreter.
in the libraries tab add the path to the lib folder of your tensorflow lib folder.
here is screenshot:
I also had import issues. I fixed it by creating a new project and specifying interpreter as ~/tensorflow/lib/python2.7
Eclipse seems to then point to the right interpreter and offers to import other relevant files - result is similar to answer above.
The answer from #mrry above was helpful - only the link to the 5 step guide seems to be unavailable.
Hope this helps!

Categories