Installed tensorflow in one environment, now import doesn't work - tensorflow

So, I installed tensorflow in one environment in Jupyter, and now I can't import anything, even unrelated modules like pandas. The thing is I don't use tensorflow, but need it as backend for keras. When I want to import any module, I receive this error.
Edit: In Jupyter, it takes an indefinite amount of time to start the kernel in tensorflow environment. Basically, I can't run any command, even assign a variable. Assigning variables work in a non-tensorflow environment, but again I can't import any module, say even pandas.
'import' is not recognized as an internal or external command,
operable program or batch file.
If there's anyway to install the three libraries, I'd be happy to know. Thank you all.

It's solved. The key point is that during the installation, a new environment should not be defined for tensorflow. I just installed all the libraries with pip command. And it works.

Related

How can I run ImageAI on my GPU and not my CPU

So I am quite new to this I was trying to find answers on google but it is kind of not working. So I am trying to run this library ImageAI library
I am able to run it normally on the CPU at least I think it runs on CPU by just calling python test.py. Am I correct there
But since the model prediction takes a long time I would like to run it on my GPU. What I was trying to do is create a conda environment and activate it but after I do I get this error.
ModuleNotFoundError: No module named 'imageai.Classification'
Although I have imageai installed in my environment
pip freeze | findstr imageai
imageai==2.1.5
As you can see by executing this command. What am I doing wrong here?
I found the solution it doesnt require the conda environment. ImageAI automatically runs on GPU if available. All you need to do is to ensure you have the GPU version of Tensorflow installed.

import matplotlib fails with DLL load error but only in spyder

I am using miniconda. Spyder is installed in the base environment and configured with spyder_kernels to point to the interpreter in my work environment called py37. That is where numpy, pandas and matplotlib are installed.
When I activate py37 in a command prompt and use python there I can use matplotlib in my scripts without incident.
When I attempt to run the same scripts from spyder, I get this DLL import error:
File "C:\Users\eli\miniconda3\envs\py37\lib\site-packages\matplotlib\__init__.py", line 190, in _check_versions
from . import ft2font
ImportError: DLL load failed: The specified module could not be found.
Can someone tell me how to diagnose this issue further? It seems like it is trying to import from the correct environment. import numpy and import pandas do work (both are only installed in py37, not base). Is this some sort of interference from the base environment? I'm aware I could install spyder in the py37 environment, but I like the spyder-kernels idea because it would keep the working environment simpler ... if I can get it to work.
It appears that this issue requires an upgrade on the Spyder and Spyder-kernel side and/or an environmental variable be set on the Windows side.
On the Spyder side, there is an improvement in the release candidate version (4.0.0rc2) with the most up-to-date python and spyder-kernels > 1.8. These had to be installed from the spyder-ide channel.
Then for me it still didn't work because an old DLL search path issue. I had to set this environmental variable which takes one system directory out of the search path for Anaconda:
CONDA_DLL_SEARCH_MODIFICATION_ENABLE to 1
On my system, I think it might have been interesting to try only this latter change.
My gratitude to the spyder developers. This took several iterations.

Problem with importing tensorflow and testing NN

I'm currently working on a program to play a game similar to atari-games. I'm using keras (python 3). I finished writing the code and I want to test it, and I have few questions about the process:
first of all, I have trouble importing tesnorflow for some reason. I've installed it using pip. I've made sure to created new env. before the installation (which finished successfully), but when I try to run my program it says:
ModuleNotFoundError: No module named 'tensorflow'
I also, tried to install the package from within pycharm, but then I get this error:
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
I've checked program requirements (such as pip, python, virtualenv and setuptools versions) and everything seems up to date. perhaps someone could point out what else might be the problem?
Is there any other way I can test the performance of my program?
Thank you very much for your time and attention.
Anaconda is a complete time-saver. I suggest create an enviornment using Anaconda and install the tensorflow by conda install tensorflow If you would like to use the gpu version, conda automatically installs the CUDA and cudnn for you too.

User folder names with a blank causes failure for anaconda

A screen shot of my problem
I have been trying to install Keras for about a week now. I installed Anaconda and then Tensorflow with Python3.5 and Jupyter. When I start up with the Anaconda3 prompt it always gives me the message
>was unexpected at this time
C:\Users\Ray Van>#IF NOT "==" #chcp > NUL
C:\Users\Ray Van>
I used to be able to just say
Jupyter Notebook but it doesn't like this
Also I want to say activate tensorflow and then say jupyter notebook and then run a Python program with Keras (for Neural networks) but no matter what I tried, nothing works. I read somewhere that having the blank in the name \Ray Van] can be a problem but I didn't set that up. Somehow it was just set up by Windows 10 and from reading various posts, it seem very difficult to change without risking having to install Windows10 again. Various places say that it is very easy to install Keras, but I have found the opposite after trying several days for 3 hours at a time. But I am not good at installing things like this and don't really understand how all the things are connected. Maybe I have to start over and install Anaconda and then tensorflow and then from within the tensorflow environment install Keras and Jupyter. I know the pip command or the conda command are used for this but I don't really understand that either. So a total newbie who just wants to run some Python programs for my Neural Network research using Keras.

TensorFlow without jupyter notebook

Do I absolutely need to use jupyter notebook to run TensorFlow in Windows ?
I tried the detect object example with the jupyter notebook, it works but I'm not really comfortable, Im used to notepad++ and running python directly on my windows without virtual environment.
I tried to copy past all the codes but I run into many hugs.
No, it is not compulsory to use Jupyter notebook to run Tensorflow on Windows. I personally use PyCharm as my IDE and Anaconda for dependency management (this is completely optional).
I would recommend you to use a proper IDE instead of notepad++ because it's much easier to do debugging using an IDE. You'll also be cloning a lot from Git when you start developing your own model, and usually the open source models out there has a lot of classes and methods in it (take Google's Inception net for example).
Another alternative would be maybe you can start posting about the bugs you are facing, then we can all start helping you.