Installing GeoPandas on Spyder 5.1.5 - python

Since updating Spyder to version 5.1.5, I'm unable to install GeoPandas. I've tried the following:
conda install geopandas
conda install --channel conda-forge geopandas
conda install -c conda-forge geopandas
and
conda create -n geo_env
conda activate geo_env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install python=3 geopandas
and none seem to work. I've also installed all the necessary dependencies, with the exception of Fiona (which returns the same installation problem).

After some research and a helpful post, I figured out a solution. There must have been an error when I previously updated Spyder to 5.1.5, and even though I had uninstalled and reinstalled Anaconda a number of times, GeoPandas wouldn't install until I removed Spyder through the Anaconda Prompt.
conda remove spyder
conda remove python-language-server (may return error but not a problem)
conda update anaconda (may return error but not a problem)
conda install spyder=5.1.5
conda install pandas
conda install geopandas
conda install openpyxl (had to reinstall)

Related

Conda install script installs wrong version and then doesnt update

Conda tells me that there is an update available, but when I try to update, it doesnt work. I run conda update -n base -c defaults conda and get the following notification:
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.10.3
latest version: 22.11.1
Please update conda by running
$ conda update -n base -c defaults conda
# All requested packages already installed.
I cannot find a github repo for anaconda. What is the issue here? Running conda --version confirms 4.10.3 is installed. I installed anaconda through the Anaconda3-2022.10-Linux-x86_64.sh, so definitely not 4.10.3.
From the documentation:
#update the conda package manager to the latest version
conda update conda
#use conda to update Anaconda to the latest version
conda update anaconda
To update to a specific version of Anaconda, enter these commands:
#update the conda package manager to the latest version
conda update conda
#use conda to install a specific version of Anaconda
conda install anaconda=VERSION-NUMBER
Did you try these steps, including updating anaconda?

How to update flask from version 1.1.2 to version 2.0 on anaconda?

When I install the latest version of anaconda distribution, it comes with flask version 1.1.2. However, I need to install flask version 2.0. How can I install flask version 2.0 (in the base environment) while keeping other existing packages installed such as sklearn and numpy, etc.?
First do conda activate base,
Then you can either do pip install flask==2.0.0 or conda install -c conda-forge flask==2.0.0. Both are okay as long as you do conda activate base first.
You should consider creating a new environment for your project and not mess with the base environment.
First do conda create -n newname, then conda activate newname.
Then you can do conda install -c conda-forge numpy pandas sklearn flask==2.0.0, you can also do pip install numpy pandas sklearn flask==2.0.0. You can install everything you need in one line.
In a nutshell:
conda activate base
conda remove flask
conda install -c conda-forge flask
Line 1: to activate your base virtual environment
Line 2: in order to avoid any conflict, remove flask 1.1.2
line 3: install the latest flask version via the channel conda-forge (2.0.1 as for now)
If you want the 2.0.0 you should do this: conda install -c conda-forge flask=2.0.0
Explanations:
Channels:
conda uses channels (like repositories where the packages are stored). By default, the channel is the anaconda channel. So, if you installed flask with conda install flask that is the same as if you did conda install -c anaconda flask. And from this page (https://anaconda.org/anaconda/flask) you can see that the actual version on this channel is 1.1.2.
About the update part:
In general, to update all your packages in a virtual environment, you first have to activate your virtual environment with conda activate [virtual_environment_name] and then conda update --all.
But as you can see from the previous link, on the default channel (anconda), the latest version is 1.1.2, so, strictly speaking, you can't update flask to a version greater than 1.1.2.
But, because on the conda-forge channel the latest version is -as for now- 2.0.1, if you install flask from this channel, you will get flask 2.0.1.
Using pip in a Conda environment:
An other option mentionned by #anarchy too is to use pip install flask=2.0.0 but you should avoid that. See: https://www.anaconda.com/blog/using-pip-in-a-conda-environment and
Is that a bad idea to use conda and pip install on the same environment?.
About not using the base environment directly:
And in order to have a clean workspace, it's a good practice to create a virtual environment other than the base environment for your projects. You can create and then activate a new environment named for example "myenv" like this:
conda create -n myenv
conda activate myenv
And so the complete code would be:
conda create -n myenv
conda activate myenv
conda install -c conda-forge flask
And finally if you want to install the latest versions of other packages like numpy and sklearn, you should use conda-forge too:
conda install -c conda-forge scikit-learn
conda install -c conda-forge numpy

Installation of Geopandas for Windows 10

There are some problems about geopandas installation for Windows 10 system. You know that this module is including some dependencies into widerange. In this mean, I presented as snapshots my system responses with this dependencies as a summary.
What is the problem?
The error just says it cannot find the file it needs in your Environment Path. Navigate to your cmd terminal and try:
conda install geopandas
Alternatively you can grab the install and all dependencies from the forge:
conda install --channel conda-forge geopandas
It gets easy when you create new environment for it, then start installing. I had followed a lot procedure, downloading wheel files and installing manually but creating the environment and then installing (using Anaconda) make it lot easier.
I have followed this from https://geopandas.org/getting_started/install.html
enter image description here
conda create -n geo_env
conda activate geo_env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install python=3 geopandas

error while installing tensorflow in conda environment (CondaError: Cannot link a source that does not exist.)

trying to install tensorflow using conda package manager
using following command
conda install -c conda-forge tensorflow
but it gives following error while executing transaction
CondaError: Cannot link a source that does not exist.
C:\ProgramData\Anaconda3\Scripts\conda.exe
I faced the same issue and
conda update -n root conda
Solved the problem. The env name "root" is for conda <= 4.3, otherwise use:
conda update -n base conda
I hope this helps.
Try to run conda clean --all --yes and conda update anaconda.
Do you have a conda.exe file in the following folder C:\ProgramData\Anaconda3\Scripts\?
Do you use the latest Conda?
Another solution could be to create a conda environments conda create -n name_environment pip python=3.5 and using pip to install tensorflow pip install tensorflow inside the new environment
after having activated it (activate name_environment).
P.S. I can not write a comment because I do not have enough reputation.
EDIT - Now i can!

I get the following error whenever I try to run conda install tensorflow

This is the error :
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- numba -> numpy[version='>=1.14,<1.15.0a0']
- tensorflow
Use "conda info " to see the dependencies for each package.
You have to run the conda info tensorflow and conda info numba to see each dependencies for each package and then you have to install those package like conda install package=version to fix the problem.
First create a conda environment if you would like using
conda create -n my_env python=3.6
Here "my_env" is the name of my environment
Then activate your environment using
source activate my_env #(for mac)
conda activate my_env #(for windows)
Once the Environment is active. you can now install the packages you need as follows:I am showing you the packages which i work upon on virtual environment and this will take care of most of your dependencies
conda update conda
conda upgrade conda
conda upgrade anaconda
conda update numpy
conda install tensorflow
Hope this will solve your problem or else try to upgrade numpy using pip:
pip install --upgrade numpy

Categories