About installing rasterframes module in Python - python

I successfully installed pyrasterframes with pip in cmd, but when I try to import it in jupyter notebook I get the following error: "No module named 'pyrasterframes'". Could you help me please?

This issue solved by removing your specific environment from jupyter by the following instruction:
"jupyter kernelspec uninstall envname"
and then installing ipykernel and readding the environment to jupyter notebooks as following:
"conda install -c anaconda ipykernel"
"ipython kernel install --user --name=envname"
notice that I should open jupyter notebooks after activating my env in cmd.
I think you can use this solution to solve similar installation problems with any other modules.

Related

Installed a package on command line and can import it via command line. Receive ModuleNotFoundError when importing in jupyter notebook

I installed the python package lifelines on my terminal. The windows terminal is my terminal of choice, with a powershell and anaconda terminal that I often used.
I tried installing the package using the provided commands in the documentation:
pip install lifelines
and
conda install -c conda-forge lifelines
Both times the installation is marked as successfull. When I run Python within the terminal I can import the lifelines package without problem. However whem I import it on a jupyter notebook it yields a ModuleNotFoundError.
The base environment I use does not contain the lifelines package when I verify its contents using the Anaconda Navigator.
The jupyter notebooks are run on Anaconda Powershell, and so are the environments and packages.
Installing on the Windows Powershell will never work. Running the conda install -c conda-forge lifelines in the Anaconda shell solved the issue.
So silly, yet so time consuming it is worth sharing.
I had a issue like this, python3 -m pip install <package_name> solved it for me. Use python -m pip install <package_name> for Python2.

Issue with Jupyter notebook and virtual environment pip

I have created a virtual environment using the following commands:
python3 -m venv venv
.\venv\Scripts\activate.bat
pip3 install ipykernel
pip3 install jupyter
python3 -m ipykernel install --user --name=venv
I have created a Jupyter notebook using the venv that I created, but when I install a package in the virtual environment, it is not recognised in the notebook.
For example, I tried to install pandas using pip3 install pandas, but when I try and import it into my notebook I get the error ModuleNotFoundError: No module named 'pandas'
The module has installed in the right place venv\Lib\site-packages\pandas\
Any ideas on what I should do?
EDIT:
I noticed that even though I created the notebook using the venv, it uses the normal python environment rather than the virtual one. Ideas on how to fix this?
Well I think I solved it. If ran the following command:
python -c "import IPython"
Which just installs IPython in my venv.
You need to restart the notebook kernel, it will probably work then.
In the future, in a notebook cell you can run
%%bash
pip install pandas
then you should be able to continue without restarting

how start and install with jupyterlab notebook?

I want to start working by jupyter notebook. I am using Mac. I did the following commands in terminal.
pip install jupyterlab
pip install notebook
They were installed well now in terminal I type :
jupyter notebook
And get :
-bash: jupyter: command not found
try anaconda, the best and easiest way to use jupyter notebook
Try this:
pip install --upgrade notebook
Then run
jupyter notebook
In case, you may have some python version inconsistency, always install PiPy packages with this command:
python -m pip install jupyter
Most of time, this type of installation, resolve many issues.
If your issue not solved, refer to this question, this is about your similar problem with Jupyter in Windows.

How to make Jupyter Notebook import packages in Python3.5

I have several packages being imported perfectly in my Python 3.5. But not in my Jupyter Notebook... When i try to Import those packages in Jupyter i get and error of module not found.
Is there a way to make Jupyter load my Python 3.5 as a kernel... or something similar. I'm working in a virtual environment. Already tried to reinstall the packages again in my virtual env But no success.
Try to install the packages inside a jupyter notebook cell like this:
!pip install package
So you are sure that the packages are installed in jupyter's environment
If you install the ipython kernel form inside the virtualenv, you can guarantee that the packages are imported to the jupyter if they are imported to this env. Also, if you use this approach, you do not need to activate the virtualenv every time you run the jupyter, because jupyter does it automatically.
$ python -m venv projectname
$ source projectname/bin/activate
(venv) $ pip install ipykernel
(venv) $ ipython kernel install --user --name=projectname
(venv) $ pip install {package needed to install}
Source: Using jupyter notebooks with a virtual environment

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"

Categories

Resources