How install kmapper? - python

I have installed kmapper since command prompt, but when I import kmapper in jupyter notebook
is visualized a error: No module named kmapper.
What can I do?
I should install kmapper, please help me.

I don't see a Conda version for this in a major Anaconda Cloud channel. Install with pip.
conda create -n my_kmapper_env python pip numpy matplotlib scikit-learn bokeh pillow
conda activate my_kmapper_env
pip install kmapper

Related

How to install Geo Pandas package in Jupyter Notebook in Python ? All solutions do not work

How to install geopandas, I really tried everything and I still has error: ModuleNotFoundError: No module named 'geopandas'. I have the latest version of Python 3.9.6. I use Windows 10, I use Anaconda Prompt, I have only one version of Python.
I do not want to create other environment, I want to install it as any other package, how to do it? I tried:
pip install geopandas
conda install --channel conda-forge geopandas
!conda install geopandas
I checked also this page: https://geopandas.readthedocs.io/en/latest/getting_started/install.html to find solution but I still do not have this package. But package folium was installed correctly by pip install folium.
Help me because I try to do in second day in a row ;/
I will transcribe here the solution I found; all glory goes to Mr. Tanish Gupta, long life to him. Source here :). I hope it helps!
I did this in my win10 PC, I have Anaconda 2.1.4 and only the Python version which comes with it (3.7 I believe). I use Anaconda Prompt, I have only that one version of Python ('cause I had the latest Py ver, but outside Anaconda, and tried this. It worked, but for that 3.10 Python version, not for the Jupyter Py ver, if that makes sense).
To my understanding, probably there is some incompatibility between the libraries installed in the base environment, so we'll be creating a new one.
In the Anaconda command prompt, create a new environment variable:
conda create -n geo_env
Activate this environment “geo_env”, then add and set conda-forge channel:
conda create -n geo_env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
Install Geopandas in the environment just created:
conda install geopandas
Next install Jupyter notebook in this environment:
conda install jupyter notebook
Note: If the above command doesn’t work for you, try conda install notebook.
Now add our environment to Jupyter notebook:
python -m ipykernel install --name geo_env
Change to our new environment in the AnacondaNavigator. Enjoy :D
In my case, then I had issues with seaborn and wordcloud in this environment, so I tried installing C++, 'cause it said in the error output, you know, I just wanted more headaches (it didn't work). Finally I installed them in the same way explained before and everything ran smoothly.
If I'm not mistaken you're either having a conflict between channels or you forgot to install geopandas packages when doing it with pip.
First of all, in an anaconda prompt, start by cleaning your environment by removing the packages that got installed by pip.
To do so just pip uninstall geopandas fiona pyproj rtree shapely.
Once you're done with that, run a conda install --channel conda-forge geopandas (normally should work).

Install python package via Jupyter

I tried to install two package (orange3 and orange3-Associate) for python via jupyter notebook by running:
!pip install orange3
!pip install orange3-Associate
II can import and use the packages via the jupyter notebook however in anaconda navigator environments I can not see any of these packages while I have all other libraries like numpy, sklearn, etc. Is it a problem or an issue?
I found a solution on this blog (update: Wayne notes in a comment below that the blog is outdated and points to this Q&A instead). Importantly, you should differentiate between conda and pip.
As you mention anaconda, you probably should use conda to install:
# Install a conda package in the current Jupyter kernel
%conda install <dependency_name>
Alternatively, if you need to use pip:
# Install a pip package in the current Jupyter kernel
%pip install <python_package_name>

Import OpenCV on jupyter notebook

I tried installing OpenCV on Windows 10 using pip.
I used this command-
pip install opencv-contrib-python
After that when I tried importing cv2 on command prompt, it was successfully imported-
When I tried importing it on jupyter notebook, this error popped up-
This is the python version I'm using-
This is pip list and as I've highlighted, opencv-contrib-python version 3.4.3.18 is installed-
Then why can't I import OpenCV on jupyter notebook, like tensorflow or numpy are also in pip list and I'm able to import them both through command prompt and also on jupyter notebook.
Please help. Thanks a lot.
You have installed openCV in Python running on your Terminal, not into the working environment which Jupyter Notebooks is running from.
Whilst in Terminal write:
py -m pip install opencv-python
When you use pip list
You should see opencv-python 3.4.3.18
More information here.
In the Anaconda Navigator. Launch conda console as below.
In the console: run conda install opencv
Try this in anaconda prompt:
First create a new enviorment :
conda create -n opencv
then :
conda activate opencv
then:
conda install -c anaconda opencv
source:youtube
You should open the anaconda prompt and then type:
conda install opencv
It should work.
It seems like you run jupyter not from conda environment, that has opencv module installed.
try to do this:
conda activate <your environment>
conda install jupyter
jupyter notebook
after that try to "import cv2"

How to Install the latest version of seaborn

I want to create a catplot using seaborn package and I know that in order to be able to do that I need the latest version of seaborn(0.9.0). I installed the package for conda using:
conda install seaborn
but it downloaded version 0.8.1.
I therefore installed the version that I want using pip:
pip3 install seaborn==0.9.0
but I keep getting the same error whenever I run my code:
AttributeError: module 'seaborn' has no attribute 'catplot' (attribute that is only available in the latest version).
Can anyone please assist with this?
Apparently conda has not yet integrated seaborn 0.9.0 into it's default channel. You may still try to get it through conda-forge
conda install -c conda-forge seaborn
You can also use pip from within the conda environment in use.
> activate
(base) > python -mpip install seaborn==0.9.0
Current versions of the Anaconda distribution already have seaborn installed, so conda update seaborn will update the package to the currently available version on the default / available conda channel. All packages can be updated with conda update --all.
conda update --name env seaborn will update a specific environment, env in this case.
conda install --name env seaborn will install to a specific environment.
conda update --name env --all will update seaborn and all other packages.
It is not recommended to use pip to install packages that already exist within the conda environment.
I was having seaborn 0.8.0. This worked for me.
sudo -H pip install seaborn==0.9.0
This worked for me:
conda install -c anaconda seaborn
Credit: https://anaconda.org/anaconda/seaborn
If you are going for developmental features of seaborn, try installing direct.
pip install git+https://github.com/mwaskom/seaborn.git#egg=seaborn
After you install a new version restart your Kernel and run your script again.

ImportError: No module named geopandas

I just ran this code and got this error, I'm not sure why:
%matplotlib inline
​
import seaborn as sns
import pandas as pd
import pysal as ps
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as pet
ImportError: No module named geopandas
Check if geopandas is installed
>>> import sys
>>> 'geopandas' in sys.modules
False => Not Installed
>>>
To install the released version, you can use pip:
pip install geopandas
or you can install the conda package from the conda-forge channel:
conda install -c conda-forge geopandas
You may install the latest development version by cloning the GitHub repository and using the setup script:
git clone https://github.com/geopandas/geopandas.git
cd geopandas
pip install .
It is also possible to install the latest development version directly from the GitHub repository with:
pip install git+git://github.com/geopandas/geopandas.git
Linux?
sudo apt-get install python-geopandas
You might encounter this problem even if geopandas is correctly installed in your active environment. Your problem might be related to ipython not being installed in the environment you installed geopandas in. In this case ipython from outside of the environment is used and will find no module named geopandas resulting in a ImportError.
Assuming a Linux OS:
You can check which ipython is used with where ipython.
You can install ìpython in your active environment by executing conda install ipython.
If using Jupyter notebook with conda use:
conda install -c conda-forge geopandas
If you have any trouble installing GeoPandas, just follow the below steps:
⦁ Go to Unofficial Windows Binaries for Python Extension Packages. (https://www.lfd.uci.edu/~gohlke/pythonlibs/)
⦁ Download the following binaries in a specifi folder in your laptop/PC:
GDAL,
Pyproj,
Fiona,
Shapely &
Geopandas
matching the version of Python, and whether the 32-bit or 64-bit OS is installed on your laptop.
(E.g. for Python v3.8x (64-bit), GDAL package should be GDAL-3.3.2-cp38-cp38-win_amd64.whl)
Go to the folder where the binaries are downloaded in the command prompt window. (C:\Users\abc\GeoPandas dependencies)
Order of execution of the following commands matter.
pip install .\GDAL-3.3.2-cp38-cp38-win_amd64.whl
pip install .\pyproj-3.2.0-cp38-cp38-win_amd64.whl
pip install .\Fiona-1.8.20-cp38-cp38-win_amd64.whl
pip install .\Shapely-1.7.1-cp38-cp38-win_amd64.whl
pip install .\geopandas-0.9.0-py3-none-any.whl
Credit
As mentioned by #marianoju, the problem is likely because you do not have IPython installed in your current environment.
The simple solution is to install IPython in your current environment.
conda install ipython
An even better solution (in my opinion) is to install Jupyter notebook, Jupyter lab in your new conda environment.
conda install jupyter
conda install jupyterlab
This will install jupyter(lab) along with its all dependencies (and that includes IPython). So, any other lurking dependency issues would have been solved in one command.

Categories

Resources