Spyder/Anaconda Navigator will not launch after Installing Geopandas - installation

I'm trying to integrate geopandas, plotly, and shply onto my workbench to make some statistical analysis and visualization easier. I have successfully integrated plotly after using the:
conda install -c plotly plotly
comand in my anaconda prompt. However, when I repeat the process for geopandas
conda install -c conda-forge geopandas
my spyder client and anaconda clients no longer open.
I have tried a few clean uninstall/re-install of the latest anaconda distribution package, but have yet to find a fix. Do I need to create separate environments to work in? How would I go about this? Thank you in advance

(Spyder maintainer here) This kind of problem is usually caused by mixing packages from different channels. In your case, you're mixing packages from the plotly, conda-forge and defaults channels. In particular, defaults (the packages provided by default in Anaconda) and conda-forge are binary incompatible because their packages are compiled differently.
To avoid this, you need to uninstall and reinstall Anaconda because you corrupted it. Then you can simply run
conda install plotly geopandas
given that these two packages are part of the defaults channel.

Related

difference between conda install and pip install in jupyter notebook

I'm a little confused with package install in anaconda environment.
I can install my python packagse in the following ways.
open anaconda prompt and do : conda install tensorflow
launch an jupyter notebook from anaconda prompt, choose the default python kernel, and do:
!pip install tensorflow
Can someone tell me what is the difference between these two cases? Where are the python packages installed? What happens when I pip install python packages in default kernel in jupyter notebook?
I was able to install tensorflow in jupyter notebook in default kernel (python3), but trying to import tensorflow give me module note found error. Does anyone know why that happened? What is happening under the hood? Very much appreciate any help to clarification.
pip is the default package manager that ships with python. Conda is also a package manager, but it is third party. Conda was made especially for data science libraries. Libraries installed with conda usually give much better performance than pip. In pip, the packages are stored in python/scripts and conda stores them at /anaconda/pkgs/. As for the module not found error. I would need more information about it, but you can check out this video. I learnt how to install TensorFlow here and would highly recommend it.

Installing networkx v2.4 for python3.7 via anaconda on Windows 10

I installed Anaconda3 (version 2019.10-Windowsx86_64) on my PC last week. It comes with networkx v2.3, but I would like to upgrade to v2.4, which should be available on Anaconda according to conda search and Anaconda's website.
I first tried the Anaconda navigator, but can't get it to work. It indicates that networkx can be updated. However, when I click Apply the navigator spends a bit of time "solving package specifications" and then gives me the empty pop-up shown below.
I also tried using conda prompt. Using conda install networkx, conda update networkx, conda install -c anaconda networkx does not result in v2.4 being installed. I also tried conda install networkx=2.4, which takes forever and then reports a very long list of package conflicts. I find this confusing because I just installed Anaconda and haven't tampered with any configs yet.
Grateful for any help on understanding what is going on and how I can attempt to fix it!
I also tried conda install networkx=2.4, which takes forever and then reports a very long list of package conflicts.
This is the key here. anaconda comes with many packages pre-installed and some of these might depend on networkx==2.3 since they might not be compatible with the newest version.
What you can do is create a new environment that has the required version of networkx:
conda create -n myenv python=<your desired python version> networkx==2.4
which will create a new environment where you can only install the packages that you need and make sure that networkx==0.24 is satisfied.
You can try this in jupyter notebook in case you are working on jupyter notebook.
!pip install networkx==2.4
I had 2.5 v installed. But something wasn't working and had to degrade it to 2.4 and above method worked.
Try this:
pip install --upgrade networkx

ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

I have trouble importing the basemap module of mpl_toolkits in python.
I've got following error message when I try to run "from mpl_toolkits.basemap import Basemap":
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
I'm using python 3.6.5 in windows.
I've found relevant Q&A in
"Python basemap module impossible to import" and I already followed what's instructed there (i.e. source activate MyProfileName, conda install basemap) but it didn't work.
The clue might already be given in the Q&A above but as I'm quite new to python, I couldn't figure out the solution.
I would recommend installing Anaconda environment from scratch. Let Anaconda handle dependencies for you. Then you need to install mpl_toolkits separately in your conda environment with:
conda install -c conda-forge basemap-data-hires
See also here.
After doing this, executing
from mpl_toolkits.basemap import Basemap
from python console should work normally.
I recently faced this problem on Windows 10. I had created a conda environment with python 3.7 and anaconda 5.2.0 and tried all retrieved solutions. But nothing worked for me and all my efforts worth many hours were in vain.
What I observed that currently Basemap is not compatible with python 3.0, so I remove the environment and creates a fresh with python 2.7 and anaconda 5.2.0. So, to help others who are juggling with same problem, here is the complete set of solution:
Getting the Basemap Toolkit (support the functionality of mapping data)
create conda environment as:
conda create -n Basemap python=2.7 anaconda=5.2.0
Activate the created conda environment:
activate Basemap
Install the following packages:
conda install -c conda-forge basemap
(do not use basemap=1.1.0, channel error comes "package basemap =1.1.0 is not
available from current channels")
"Only the 'crude' and 'low' resolution datasets are installed by default". You may
need to install the following for high resolution:
conda install -c conda-forge basemap-data-hires
PROJ is a generic coordinate transformation software that transforms geospatial
coordinates from one coordinate reference system (CRS) to another. This includes
cartographic projections as well as geodetic transformations.
conda install -c conda-forge proj4 </b>
(Better to avoid pro4=5.2.0 as specific packages generates error)
PROJ is a generic coordinate transformation software that transforms geospatial
coordinates from one coordinate reference system (CRS) to another. This includes
cartographic projections as well as geodetic transformations.
After installation of the Basemap toolkit, open the jupyter notebook a fresh, it should show the current environment in upper right corner.
To check the current environment in jupyter, type:
import sys
print(sys.executable)
If still the activated environment is not shown then:
run the following command in anaconda prompt in activated environment Basemap:
python -m ipykernel install --user --name Basemap --display-name "Python (Basemap)"
Now change the environment from Kernel-> change kernel -> Python (Basemap)
Finally Python(Basemap) should be shown in upper right corner.
Following needs to be imported in your program then to use it:
from mpl_toolkits.basemap import Basemap
In case of error: "No module named 'mpl_toolkits.basemap" type the following in jupyter:
import os
os.environ['PROJ_LIB'] = r'C:\ProgramData\Anaconda3\pkgs\proj4-5.2.0-h6538335_1006\Library\share
After this you need to restart apps for them to pick up the change, including explorer.exe. Restarting the machine is reccomended (but not required).
All the best. I hope this will work for you as well.

Unable to open h2o in anaconda

after following the instruction in http://docs.h2o.ai/h2o/latest-stable/h2o-docs/downloading.html#install-in-python, I was able to install h2o v 3.16.0.2. I was also able to use command line instructions mentioned in the above website and test that it is working.
python
import h2o
h2o.init()
h2o.demo("glm")
However, when I launch anaconda spyder, I am not able to import h2o. How do I link the h2o I have installed and bring it into Spyder python?
Update:
I have already tried {conda install -c anaconda h2o } which is mentioned on Anaconda.org, but that installs older ver 3.10 of h2o and that did not work either.
thanks for your help.
I believe the problem is due to your python environment. When you install Anaconda, you need to use anaconda pip, to ensure that the installed packages are available in conda.
The short answer is you can install the lastest stable version of H2O (3.16.0.2 as of today) using conda via h2oai channel instead of anaconda channel (h2o maintains it's own channel):
conda install -c h2oai h2o
this should solve your issue.
But more generally, the packages will appear in conda if you use anaconda pip. You can check which pip is being used by doing
which pip
and making sure that the path to the pip is within your anaconda distribution; something like /home/<userdir>/anaconda/bin/pip instead of /usr/bin/pip
Same is true also for Python. Try checking if starting Python in terminal points to anaconda Python by doing which python. If that's not the case, than you would need to add the conda installation of Python to your PATH variable. Please refer to conda docs for instructions https://conda.io/docs/user-guide/install/index.html
It would have been helpful if you had included information regarding your operating system in the question.

How to install ipdb with Anaconda on Windows?

I already have Python 2.7 installed but I wanted to try IPython so I installed IPython via Anaconda as recommended on the ipython website (although not sure what the pros/cons of doing this are). Now I would like to use ipdb debugger. I guess I need to make sure it installs underneath the Anaconda version of python rather than the normal python.
How do I install this? In general if I want to install some arbitrary python module under Anaconda how do I do this?
Actually I think in the case of ipdb it's already installed with Anaconda. But in general it appears you can just install stuff via either pip or easy_install as necessary. The key that I was missing is to make sure you are using the pip/easy_install that comes with Anaconda (which are .bat files in the Scripts directory) rather than the system Python's pip/easy_install. So:
Anaconda\Scripts\easy_install somepackage
This will install somepackage in Anaconda\lib\site-packages\ and not in the system python. This appears to work and I can now import somepackage from my anaconda python. This seems to work. It wasn't clear to me from reading Anaconda documentation if everything needed to be in a conda package or not.
This answer seems to support this idea: Installing Anaconda into a Virtual Environment
Generally the first thing to check is whether someone else has already built it for your version of python and uploaded it to anaconda.org:
anaconda search -t conda ipdb
then find a repository with ipdb built for your OS, and try
conda install -c <repository> ipdb
e.g. conda install -c conda-forge ipdb
You might need to try a few different ones to find one built for your version of python. There is a feature request to make this easier.
If that doesn't work, then pip install ipdb will

Resources