The anaconda-navigator stops working after installing gdal - python

I am new to python and anaconda
I am using Windows 10 and Python 3.5
After installing gdal with the command (in the Anaconda prompt)
>conda install -c conda-forge gdal
the anaconda-navigator does not launch anymore and I get the error message:
pythonw: This application failed to start because it could not find or load the Qt platform plugin "windows" in "".
I think it is because some packages were downgraded... during the installation I got the message:
The following packages will be DOWNGRADED due to dependency conflicts:
anaconda-navigator: 1.3.1-py35_0 --> 1.2.3-py35_0
matplotlib: 1.5.3-np111py35_0 --> 1.5.1-np111py35_0
what is the best way to solve this problem?

I found two solutions to this problem, I think the second one is better:
Solution 1: I first solved this problem by using python 2.7 instead of 3.5.
In fact with the command:
>conda install gdal
I got the following message:
UnsatisfiableError: The following specifications were found to be in conflict:
- gdal
- python 3.5*
Use "conda info <package>" to see the dependencies for each package.
So I created a new environment with python 2.7, following the instructions here
>conda create -n py27 python=2.7 anaconda
activate py27
Then I installed the gdal (and other packages I needed)
>conda install gdal
It is then possible to directly launch the anaconda-navigator (just typing anaconda-navigator in the command line. Also opening the anaconda-navigator from the menu I can select the environment with "application on: py27" and start spyder in this environment.
Solution 2: I kept using python 3.5 but instead of using conda install I downloaded the compatible binaries from the "Unofficial Windows Binaries for Python Extension Packages"
>pip install <package-path>

Related

Updating Spyder in Anaconda to 5.2.2

I feel like I'm going absolutely insane as I can't find any information on this anywhere... Is there anyway to update Spyder in Anaconda Navigator to version 5.2.2? The navigator shows that the highest possible version for Spyder is 5.1.5:
I particularly want to update to 5.2.2 because the debugger in 5.1.5 is broken, and it seems the only correct way to fix it is to update to 5.2.2. See Link to stackoverflow stating that one needs to update to 5.2.2 to fix the debugger
I've tried:
conda install spyder==5.2.2
but it just says "PackagesNotFoundError: The following packages are not available from current channels: - spyder==5.2.2"
I've also tried:
pip install spyder==5.2.2
But get the error "ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\Users\##\Anaconda3\envs\spyder\Lib\site-packages\PyQt5\QtCore.pyd'
Consider using the --user option or check the permissions."
Also trying,
pip install spyder==5.2.2 --user
The command does seem to run to completion without error, but the IDE doesn't seem to have updated as it still says it's 5.1.5 and it also says some things about a warning of missing dependencies (and the debugger still doesn't work).
Any suggestions?
Spyder 5.2.2 is only available for the moment through the conda-forge channel. To install it I recommend you to create a new env using only conda-forge packages. You can do that by running from an Anaconda prompt something like the following:
conda create -n spyder-env -c conda-forge python=3.9 spyder=5.2.2
To check what is the latest version available in the different channels you can go to https://anaconda.org/search?q=spyder
Edit: Currently Spyder 5.2.2 is available from the default anaconda channel. However, the latest Spyder release currently is 5.3.2. Just in case, the conda command to get the latest Spyder version installed in a new env with Python 3.9 looks something like:
conda create -n spyder-env -c conda-forge python=3.9 spyder
I have run the following in command prompt window. It has helped
conda remove spyder
conda remove python-language-server
conda update anaconda
conda install spyder=5.2.2

Update kernel modules after Spyder update

I updated my Spyder today to Spyder 5.1, and now it keeps showing me this error message:
Your Python environment or installation doesn't have the spyder‑kernels module or the right version of it installed (>= 2.1.0 and < 2.2.0). Without this module is not possible for Spyder to create a console for you.
You can install it by running in a system terminal:
conda install spyder‑kernels=2.1
or
pip install spyder‑kernels==2.1.*
I already tried both commands, the pip one works but I still get the error message, the conda command does not even work and shows me
The following packages are not available from current channels
Normally I use conda for all packages that are availabel on conda, so maybe someone faced the same issue?
Version 2.1 is only available through Conda Forge at this time. Try
conda install -c conda-forge spyder-kernels=2.1
So far I've had to remove spyder-kernels from any env from any env that has it before I'm able to get it to install on any other env. I'm using conda. It seems I can't have more than one env available for use without constantly swapping where spyder-kernels is installed. This is the case for Windows 10 and MacOS. The spyder docs say to just ignore the issue - and that it was allegedly fixed by now - but I don't know how to ignore an error that makes it impossible to start a python console.
Correction: After erasing all envs and starting over from scratch (zero envs), I am now able to install spyder-kernels on multiple newly-created envs and each one functions in console without an issue.

pybrain install in env but No module named 'pybrain'

I'm new to python and Anaconda
I have python 3.8 in my (base) env, and i need pybrain, so since it's not compatible with my current version of python, i created a new env(first i tried all of it with python 3.5, didn't work, so i tried 2.7, same result):
conda create --name py27 python=2.7
then activated it:
conda activate py27
and installed pybrain there:
conda install -c mq pybrain
I checked that it has been installed successfully with:
conda list
pybrain 0.3.3 py27_0 mq
after launching jupyter notebook from same terminal, with (py27) as the 'header'?? of my command line, it opened successfully, i even checked that currently it's opened in expected environment, by typing in a cell:
!conda info
and as i expected, saw the line
active environment : py27
but also, which i guess is importnant:
python version : 3.8.3.final.0
though i am confused with ouput of:
!python --version
cause it's:
Python 2.7.18 :: Anaconda, Inc.
So when i open my notebook i type
import pybrain
and i get:
No module named 'pybrain'
Please point me in direction: what i'm doing wrong? Also it is my first virtual env(distinct from the (base) one), so i probably missing some important concepts.
Fortunately i've found a solution to use pybrain with python3 - i just downloaded it from source !pip install https://github.com/pybrain/pybrain/archive/0.3.3.zip and it works in python 3.8

Installing Tensorflow - not supported wheel

I have installed Python version 3.5 and 3.6 and anaconda.
The following error occures when trying to install tensorflow following the steps here
https://www.tensorflow.org/install/install_windows
unsing anaconda
(tensorflow) C:> pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
tensorflow-1.0.1-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.
As I am new to Python, I do not know how to circumvent this probelm.
I am using Win10 with 64bit.
Thanks a lot and best,
Martin
I ran into the same difficulties with the same error. It seems to be that Python 3.6 isn't immediately supported and found a sort of workaround here (note that this involves installing Python 3.5 which I did not already have installed, I don't know if this should be done a different way if its already installed):
If you are using anaconda distribution, you can do the following to use python 3.5 on the new environment "tensorflow":
conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow
\# or
\# pip install tensorflow-gpu
It is important to add python=3.5 at the end of the first line, because it will install Python 3.5.
If you've already created the tensorflow environment (the conda create step), you'll have to delete it and start over. Otherwise, you'll run into an error "CondaValueError: Value error: prefix already exists: C:\[your environment location]" (If you run into the unsupported wheel error, then you probably created the environment already.)
To delete your previous environment, according to the Conda Cheat Sheet, you first deactivate from (tensor flow) if needed by calling deactivate, then call conda remove --prefix ~/bioenvcopy --all. For ~/bioenvcopy I believe you use the tensorflow environment path. The location can be found by calling conda info --envs (citing the cheat sheet once again). Mine, for example, was conda remove --prefix ~/Anaconda3/envs/tensorflow
I successfully used this work around on Windows 10.
This solution probably be obsolete when 3.6 is supported.
Creating the tensorflow env without the correct python version did not work for me. So I had to do the following, which worked...
>deactivate tensorflow # start by deactivating the existing tensorflow env
>conda env remove -n tensorflow # remove the env
>conda create -n tensorflow python=3.5
>activate tensorflow
i had the same problem in windows 10 and python 3.6
so i navigated to anaconda navigator ( just search anaconda navigator in start search).
in the Environment tab you can create/delete your environments.
just create an environment, name it tensorflow and choose python 3.5 as python version.
then you can activate tensorflow in your command line:
activate tensorflow
and install tensorflow with :
pip install tensorflow #or tensowrlow-gpu
I had the same problem after hours of searching, I found that to save yourself from installing error problem in tensorflow. The convenient way for installing tensorflow is by creating a virtual environment in Conda with python 3.5.2 and using Conda-forge. This is done by running this commands:
conda create -n tensorflow python=3.5.2
activate tensorflow
conda config --add channels conda-forge
conda install tensorflow
Try installing the 64-bit version of Python 3.6.8:
https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
I was getting the same error with the same OS and that's what fixed it. Apparently Tensorflow doesn't work on 32-bit Python even if your OS is 64-bit.
Try uninstalling everything (python, etc.) and try again using the cmd only, not git bash or PowerShell.
https://github.com/tensorflow/tensorflow/issues/9264
In Anaconda prompt, follow the instruction on Installing with Anaconda,
conda create -n tensorflow
activate tensorflow
Then the third step is a little different, try:
pip install tensorflow
This should work, good luck! If anything wrong happens, please let me know.

Installing Pyomo on Windows with Anaconda (Python)

I would like to solve LP and ILP with Pyomo (Coopr) but unfortunately I am so newbie and I cannot run it properly.
I have already installed Pyomo (Coopr) by following its instructions
pip install Coopr
I can import the module without problems:
$ python
Python 2.7.5 |Anaconda 1.8.0 (64-bit)| ...
Type "help", "copyright", "credits" or "license" for more information.
>>> import coopr.pyomo
>>>
At this point is where I get lost since I can't find the path where in theory I have installed the package
(/coopr.pyomo/examples/pyomo/diet).
I think I have to create an enviroment but I have recently read that there is a better integration now with conda v. 2.1 (link)
There is a branch of conda (new-pypi-install) that adds better integration with pip and PyPI. In particular conda list will also show pip installed packages and conda install will first try to find a conda package and failing that will use pip to install the package.
My final goal is to implement this into an IPython notebook and be able obtain the results as output.
Note: I am trying to run the demo file
pyomo diet1.py diet.dat
It is 2017 and pyomo can be easily installed via conda
conda install -c conda-forge pyomo pyomo.extras
To install LP and NLP solvers, conda can also be used.
conda install -c cachemeorg glpk ipopt_bin
If you are in a Mac or linux, you can install updated versions using conda-forge.
conda install -c conda-forge glpk ipopt
If you prefer to install pyomo or solvers via pip:
Check that the PATH on windows where is located pyomo.exe is indeed C:\Anaconda\Scripts
Besides, the PATH was set correctly since the cmd recognized the pyomo command at the beginning
With:
echo %path%
on the cmd you can get a list of all the paths (where the C:\Anaconda\Scripts\ is included"
So with Anaconda it was only necessary to set the path where the glpsol.exe is located, to do that from the cmd.exe and considering that you have unzipped your winglpk on "C:\glpk\w64":
setx path "%path%;c:\glpk\w64"
After that, restart the cmd and navigate with the "cd" command where you have the data.py and data.dat
Finally it works! Thanks to the mailing list of pyomo project for the indications
For more information I recommend to read the next links:
wingplk:
http://en.wikibooks.org/wiki/GLPK/Windows_executables
setting the path on windows 7:
http://www.voidspace.org.uk/python/articles/command_line.shtml
https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them
In Acandona Navigator, go to "Environments" and then, where says "base (root)", open the terminal and type:
conda install -c conda-forge pyomo
Additionally, if you want to install the glpk solver, execute:
conda install -c conda-forge glpk
To check all your available solvers, executing the following:
pyomo help --solvers
To solve the problem, execute:
pyomo solve diet1.py diet.dat

Categories

Resources