Can't install Spyder after installing Tensorflow and Keras - python

I'm struggling to install Spyder (5.1.5) after installing Keras and Tensorflow.
Here are the steps I have taken so far:
Install Anaconda
Within Anaconda Navigator create a new environment named 'tensorflow'
Install tensorflow and keras within Anaconda Navigator in the 'tensorflow' environment.
attempt to install Spyder from Anaconda Navigator in the 'tensorflow' environment. I get the following error message when I do this:
'spyder cannot be installed on this environment. Do you want to install the package in an existing environment or create a new environment?'
The other thing I've tried, from the Anaconda prompt:
conda activate tensorflow (activate tensorflow environment)
conda install spyder
I get the following error:
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
Thanks for any help!

On command prompt type
#Set Up Anaconda Environments
conda create --name tf python=3.8
#Activate the new Environment
source activate tf
#Install Tensorflow
conda install tensorflow
#Install Spyder
conda install spyder
#Launch Spyder
spyder
#Verify installation
import tensorflow

I had the same problem, and the solutions here by Ikram and Ashwini resolved my issues. The key fix was that you need to create an environment with Python 3.7, not 3.8.

My solution was to install Spyder first in a clean environment and then use pip.
pip install tensorflow
which installed tensorflow.keras as well.

Related

Package installer conda failed. Open to other installation means

I think I have an environment problem with miniconda. Here is what I succeded(o)/mismanaged(x) to install python mayavi package.
The documentation writes to type :
(o) conda install vtk
(x) conda install pyqt=4
<(x) conda install mayavi> (not performed)
The output message for another cmd (conda install -c anaconda -c conda-forge mayavi) are:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
I understand that I must check the first failed package: pyqt. There are similar messages, before the shell windows simply breaks. I have read that an updated environment could work but my OS (fedora35 as virtual machine) and python 3.9 + miniconda3 are fast from best versions. Any suggestion or help to fix this or trying docker are welcome

Conda Environment and Jupyter Notebook, Python 3.9.2

My Conda Environments are not showing up in my Jupiter Notebooks. I've reviewed all the (excellent) dialogue here, but it doesn't appear to work for python 3.9.2.
I tried the following, which didn't work:
conda install jupyter
conda install ipykernel
conda install nb_conda
Then when I try the following conda install nb_conda_kernels I get the following error:
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- nb_conda_kernels -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.8,<3.9.0a0']
Your python: python=3.9
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
How can I get my conda environments to show in jupyter notebooks in python 3.9.2? Thank you!
Try using the conda-forge channel, e.g.:
$ conda install -c conda-forge ipykernel
And you don't need to install jupyter if this conda env is just a kernel to add, if that's what you want to do.
After that, you need to run this in that conda env:
$ python -m ipykernel install --user --name vanilla --display-name "Python 3 (vanilla)"
Replace the name and display-name to your liking.

Anaconda Solving Environment fails in New Environment

I'm trying to set up tensorflow-gpu on my local machine to train neural networks on my RTX 2070 super. Unfortunately, I get the issue of the environment failing to solve, even in a brand new environment.
I originally tried to install tensorflow-gpu directly through Anaconda, but even with cudnn and cudatoolkit installed, it wouldn't recognize the GPU. I think it may be time to jump ship for pytorch...
Error codes;
(base) C:\Users\Albert>conda install -c conda-forge cudnn
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
The packages you are trying to install may be conflicting with your already installed packages. Try to create a new environment for tensorflow with a minimal set of packages:
conda create --name tf python cudnn -c conda-forge
conda activate tf
You can then install other packages with either conda or pip in this new environment.
In general, I find that creating separate conda environments for different tasks or projects is a better way to use conda
The conda documentation has details about managing environments
It's might occour because of the version conflict, you can just uninstall the python version in the existing conda environment or simply create new Conda environment.
To Change the python version-latest on existing environment:
conda uninstall python
conda install python -y
To create a new conda env
conda create -n <env-name> python -y
conda activate <env-name>
To install conda use any of the following commands:
conda install -c conda-forge tensorflow
conda install -c conda-forge/label/broken tensorflow
conda install -c conda-forge/label/cf201901 tensorflow
conda install -c conda-forge/label/cf202003 tensorflow
reference: https://anaconda.org/conda-forge/tensorflow
Try cleaning conda cache-files in case of error

Can't run Jupyter Notebook with python 3.9 env

I'm new to using python and conda (and linux for that matter) and I've had some trouble running a Jupyter notebook through a python 3.9 environment. I've noticed that the base 3.8.5 environment works (and allows me to open Jupyter 6.1.4) , but I'm not sure why. I've updated anaconda and conda through conda update conda and conda update anaconda and get the same
# All requested packages already installed.
In the anaconda-navigator GUI, when I try to use a py39 environment and click install on Jupyter, I notice it tries to install Jupyter version 6.0.3 and I also get this error.
I've also tried to install pykernel into my env (not sure if it would've done anything to help my issue) in which I get:
$conda install ipykernel
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
`Specifications:
- ipykernel -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']
Your python: python=3.9
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- ipykernel -> python[version='>=2.7,<2.8.0a0|>=3.5,<3.6.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0']
Your python: python=3.9
I'm assuming that is why Jupyter was unable to install notebook. I'm really new to this stuff so if any more detail is required from me, please let me know. I don't really understand this issue and can't find anything similar.
You can follow the steps below:
conda create -n py39 python=3.9
pip3 install --upgrade pip
pip3 install jupyter
Go to anaconda prompt
Activate py39
Run jupyter-notebook
Run after changing path as per your machine : python C:\ProgramData\Anaconda3\envs\py39\Scripts\pywin32_postinstall.py -install
Run : jupyter-notebook from anaconda prompt
Check version of Python on Jupyter notebook.
Yo must write three code in the terminal.
conda create -n py39 python=3.9
pip3 install --upgrade pip
pip3 install jupyter

Why doesn't OpenCV get installed on the base (root) environment of Anaconda?

After installing Anaconda, at first, I installed tensorflow with conda, then I tried to install opencv with the following conda commands:
conda install -c conda-forge opencv
conda install -c conda-forge/label/gcc7 opencv
conda install -c conda-forge/label/broken opencv
conda install -c conda-forge/label/cf201901 opencv
conda install -c conda-forge/label/cf202003 opencv
But, none of the avobe worked, it failed to install opencv on my base (root) environment. (However, I became able to install it on a different environment.)
The error message I got is:
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
I also tried to install opencv with Anaconda Navigator on base (root) environment. But, it didn't work also.
Then, I tried to install opencv with pip with the following commmand:
pip install opencv-python
But, it also didn't work.
Now, How can I install opencv on my base (root) environment?
Your (partial) error message (from the comments):
Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
and the fact that you were able to install it into a different environment:
However, I became able to install it on a different environment.
Indicate that you have conflicts with other packages in your base environment, i.e. conda was not able to determine how to fit opencv and its dependencies together with other packages in your base environment.
The best practice here would be to set up a new environment and only install the packages that you need for a certain project.
Alternatively, you could also uninstall anaconda and install miniconda (which is the same as aanconda, but without the preinstalled packages) and then install into base only what you need.

Categories