I am tried to do setup tensorflow in anaconda.
I install Anaconda3-2019.03 which support pyhton3x. Now I learnt a lot and I could know that tensorflow doesn't works in Python 3.7.0 . That's why I update the Python version into Python 3.6.0 so that I can use tensorflow and I can install may be all packages but after all packages installation,
I run a command in anaconda promots,
conda install python=3.6.0
but it shown an error and that is,
Preparing transaction: done
Verifying transaction: failed
Note: How can i solve this issue?
Please help me. Advanced thanks.
YOu could create a new environment inside of conda dedicated for 3.6 with:
conda create --name py36 python=3.6
But then you also have to install tensorflow in there as well.
But Tensorflow works with Python 3.7.
Related
I am using Anaconda to build environments. I've been using pip install my_module the entire time, and I've recently realized this is incorrect. The environment I made is called dp_offfsets_environment and I have been able to run my flask app I wrote in IntelliJ using an SDK linked to this environment.
Why is this? Seen below, when calling conda list no packages are installed under my environment so I would expect my flask app to fail.
What is pip list displaying below? Is it showing packages installed in my base environment?
How do you recommend uninstalling these packages and moving them into the actual environment?
(dp_offsets_environment) C:\WINDOWS\system32>pip list
Package Version
---------------------- -------
click 8.0.3
colorama 0.4.4
cycler 0.10.0
Flask 2.0.2
fonttools 4.29.1
importlib-metadata 4.10.1
itsdangerous 2.0.1
Jinja2 3.0.3
kiwisolver 1.3.1
MarkupSafe 2.0.1
matlab 0.1
mysql-connector-python 8.0.26
packaging 21.3
pandas 1.3.0
Pillow 8.3.1
pip 22.0.2
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2021.1
setuptools 47.1.0
six 1.16.0
typing_extensions 4.0.1
Werkzeug 2.0.2
wheel 0.37.1
zipp 3.7.0
(dp_offsets_environment) C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\ckurtz\.conda\envs\dp_offsets_environment:
#
# Name Version Build Channel
When you run conda create -n dp_offsets_environment, then conda creates an empty environment, i.e. with no packages. conda does not install python, pip or anything else in the environment. So when you run pip with that env activated, you will still get whatever pip is first located in your PATH (most likely from your base env).
So whenever you ran pip install nothing was installed to your currently active conda env and your flask app was probably not using that conda env, but also used the python that corresponds to your pip.
You need to install python/pip to your env and then install to your env.
See this as an example (I added annotation with ###):
(base) C:\Users\FlyingTeller>where pip
C:\Users\FlyingTeller\miniconda3\Scripts\pip.exe ### We are in base, so pip from base is found
(base) C:\Users\FlyingTeller>conda create -n someEnv
Collecting package metadata (current_repodata.json): done
Solving environment: done
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\FlyingTeller\miniconda3\envs\someEnv
### Note: No packages are being installed
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate someEnv
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) C:\Users\FlyingTeller>conda activate someEnv
(someEnv) C:\Users\FlyingTeller>where pip
C:\Users\FlyingTeller\miniconda3\Scripts\pip.exe ### <----- pip still from base env
(someEnv) C:\Users\FlyingTeller>conda install python pip
Collecting package metadata (current_repodata.json): done
Solving environment: done
Please update conda by running
$ conda update -n base conda
## Package Plan ##
environment location: C:\Users\FlyingTeller\miniconda3\envs\someEnv
added / updated specs:
- pip
- python
### Download and installation pruned
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(someEnv) C:\Users\FlyingTeller>where pip
C:\Users\FlyingTeller\miniconda3\envs\someEnv\Scripts\pip.exe ### Only now pip is in this env
C:\Users\FlyingTeller\miniconda3\Scripts\pip.exe
(someEnv) C:\Users\FlyingTeller>
Side Note
I've been using pip install my_module the entire time, and I've recently realized this is incorrect
This is a misconception of a commonly given advice "Do not use pip in a conda env". This advice is always a bit strong. There is no reason to refrain from using pip in a conda env all together. There is a good reason to be careful and aware of certain things that can easily break your env. There is also a good post on anaconda.org about this.
For anyone looking back on this, I discovered I had another instance of Anaconda on my machine. My company gives out laptops with Spyder installed which by default, has it's own version of Anaconda. I did not know Spyder came with Anaconda so I accidently installed two versions of Anaconda during my initial setup. To fix this I had to go through and uninstall both instances of Anaconda on my machine including their packages. Once completely removed, I reinstalled Anaconda, and my problems were alleviated.
I have spent a lot of time tying to install tensorflow for windows. I keep getting errors like "not supported."
I have tried the commands:
pip install tensorflow
and
pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl
I found that tensorflow works with python 3.7-3.10 so if you have a higher version of python, consider installing an older one.
It worked for me, I had python 3.11 is I installed python 3.9 and it worked.
Note that TensorFlow needs x64 Windows and that Python 3.5 and higher go with pip3 instead of pip. Still, there's a glitch with the installation script; I ran into the same problem and resolved it by using Anaconda, an alternative package manager for R and Python.
Once you've installed Anaconda, run the Anaconda prompt, create a new environment (called here tfenv), and activate it:
>conda create -n tfenv
>conda activate tfenv
Then, you can install TensorFlow
>conda install tensorflow
to install tensor flow you need to do this:
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
it seems to work, and has a different link to yours. I think your link may be for a different system.
I am on macOS Sierra 10.12.5
My end goal is to install the zipline python package and get it to run properly. However, I have hit some obstacles and since I am new to Unix and python as well, I thought maybe someone could push me in the right direction.
On the zipline website it says there is support for python 3.5. I already have python 3.6 installed via conda on my system so I decided to create an environment for the former version.
First, I did conda create -n py35 python=3.5 anaconda in the directory /anaconda/envs/py35. This installed python 3.5.3. Then, I use source activate py35 to activate it.
Next, I attempt to install zipline using a suggestion on their website with the command:
conda install -c Quantopian zipline
And I receive this error back:
Fetching package metadata ...........
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in
conflict:
- python 3.5*
- zipline -> logbook -> python 2.7*
Use "conda info <package>" to see the dependencies for each package.
I'm not sure I fully understand why python 2.7 would be in conflict if I am working from within an environment, I assumed that was the point, so nothing conflicts with other python versions. Also, it says python 3.5* does that mean it's in conflict with itself? Thanks for the help.
As discussed in comment:
pip install zipline
did you give pip install zipline a try. A lot of times conda doesn't work for me, whereas pip does.
--
#VikashSingh Yes, I am trying it now, pip did install zipline but when I attempt to run a buyaapl.py script I get an error No module named pandas.tseries.tools
I have no clue what buyaapl.py is. Please start another question and share the code as well.
PS: Probably you don't have pandas installed in the environment. Try pip install --upgrade pandas
You should run the conda install -c Quantopian zipline after you activated your conda environment.
source activate py35
Then, when you see your shell becomes (py35)$, you can run conda install -c Quantopian zipline again.
ref: http://www.zipline.io/install.html
Hi I have installed tensor flow in my 64 bit system using Window OS using pip3 install --upgrade tensorflow. Now I can able to work using tensorflow in my command prompt.
But while I'm trying to use it in my Anaconda ,Spyder (Python 2.7) I'm getting error message in import tensorflow as tf statement. It is saying No module named tensorflow. I'm new to python & tensorflow. Can you please help me to solve this issue?
Thanks
I solved the problem by uninstalling ipython and installing jupyter within the environment.
source activate myenv
conda uninstall ipython
conda install jupyter
Create a new conda environment. Your steps to create one with python=3.5 is correct. if you do not do this then you will have errors.
Once you have created that environment make sure you enter it: activate envName for example. You should get something like:
(envName) C:/> _
Then you should be able to install using pip install tensorflow
Once that has installed then run conda list to ensure that your conda env is happy that Tensorflow is installed. Then test it out by running
```
python
>>>import tensorflow as tf
```
Tensorflow on Windows will NOT work on anything but Python 3.5 at time of writing. Please remember to activate you conda environment by typing activate yourenvName and ensure that your environment is 3.5 when you create it.
pip3 install --upgrade tensorflow
installs tensorflow for Python3, and you want to use it in Python2. Try to
pip install --upgrade tensorflow
For more info read docs
I know that there exists a link for installing Tensorflow for python 3.5 on
Windows Installation link. There also a similar question on StackOverflow link also, but it case when I use this command:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl
But it said Wheel package needs to be updated. So I updated it using pip and ran the application once again. The output was
tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl is not a supported wheel on this platform.
So how do I solve this problem ? Please help.
I've tried to install the cpu version of TensorFlow.
conda upgrade conda
conda upgrade --all
conda create -n tensorflow python=3.5.
activate tensorflow
conda install -c conda-forge tensorflow
This will create an "environment" that will contain all of your packages you need (the example above is just tensorflow) and you will be able to import that library while you are in that environment anaconda is really just used to manage packages and segregate projects that require different packages
When your finished with your environment, to close out use:
deactivate
these commands are slightly different on OSX/Linux so be sure to look them up if you are on a different operating system
If you are using TF for some machine learning then you will probably want these packages in your environment as well:
conda install pandas matplotlib jupyter notebook scipy scikit-learn
Place that line between (activate tensorflow) and (conda install)
The executable, Anaconda for python 3.5 is not available on the official website.
An alternative to downloading that version is to download the latest version of Anaconda(3.6 as of 9 May, 2017), open your cmd shell in windows and execute the following commands. Note that the activate command is not fully supported in Windows Powershell. Click here to see why.
conda create --name tensorflow python=3.5
activate tensorflow
conda install -c conda-forge tensorflow=1.0.0
The answer has been borrowed from Anaconda Public Google Group.