"" ModuleNotFoundError: No module named 'geopy' "" - python-3.x

I can't seem to use a module in Jupyter notebooks that was successfully installed to my mac via pip3 install geopy.
I do not understand anything about working directory, where the module is being sent after download, or where jupyternotebooks is grabbing modules when you import them. Please help
import geopy
ModuleNotFoundError: No module named 'geopy'

If you want to use a particular package in a jupyter notebook you can use the following command in a code cell in a jupyter notebook.
!pip install geopy
In the next code cell you can try
import geopy
This will at the least ensure you have the package to use within the jupyter notebook.
You may want to read this text for details on python and pip

Related

ModuleNotFoundError: No module named 'win32api

I am using embedded python 3.7.4
Getting the folliwng error when trying to create new file in jupyter notebook
File "D:\Users\sgangop7\python3.7.4\Lib\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ModuleNotFoundError: No module named 'win32api'
Solutions Tried:
fresh install of jupyter notebook
pip install pypiwin32
pip install pywin32
Running the pywin32_postinstall.py
Added 'D:\Users\sgangop7\python3.7.4\Lib\site-packages' in the PATH variable of environment variable
Copied 'win32api.pyd' to 'D:\Users\sgangop7\python3.7.4\Lib\site-packages\win32\lib'
I cannot find any other solution for how to fix this issue.
On your jupyter notebook, you can try these commands :
import sys
sys.path
You will see a list of paths which Python is using to find packages. If your path "D:\Users\sgangop7\python3.7.4\Lib\site-packages\win32\lib" isn't in the list, you may need to add it. You can do it like this :
sys.path.insert("D:\Users\sgangop7\python3.7.4\Lib\site-packages\win32\lib")
Good luck !

Why is beautifulsoup4 not importing to my script?

Before I explain my problem I want to start by saying that I have looked all over this site for an answer and tried almost all of them, to no avail.
I am on a windows machine, in a virtual environment. I have a command prompt opened in the virtual environment. I have already pip installed over a dozen modules that are being imported into my script and working perfectly. When I run the line:
from bs4 import BeautifulSoup
I get this error:
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
In my command prompt I can do 'pip list' and see beautifulsoup4 version 4.9.0. As well as in my virtual environment folder I can go into Lib\site-packages and I see all of my other installed packages that work in my script, along with a folder called 'bs4' and one called 'beautifulsoup4-4.9.0.dist-info'. I have also tried pip uninstall beautifulsoup4 and then re installed it, confirming that it did not show up in pip list between running those.
I am completely at a loss for why I cannot access the bs4 module. Anyone have any ideas for me to try? Thanks in advance.
EDIT: I am currently using VS Code and have pip installed several other modules including pymysql and google-api packages. I have successfully connected to my gmail and Amazon RDS database, so i know the other modules are working properly. For some reason its only BeautifulSoup4 I am having issues with.
EDIT 2: I opened up ipython from my virtual environment, and I entered from bs4 import beautifulsoup and i get this error.
ImportError: cannot import name 'beautifulsoup' from 'bs4' (C:\Users\Brian\Desktop\Projects\VirtualENVs\test_venv\Lib\site-packages\bs4\__init__.py)
EDIT 3: I finally just opened a new command prompt and pip installed beautifulsoup4 onto my computer outside of the virtual environment and now it works fine.

Import error, there is no module named numpy, but it says that it is installed?

So I trying to install and run from MSFT the cntk, you know, just for fun. Anyway, I keep getting this error which says:
import numpy as np
ModuleNotFoundError: No module named 'numpy'
Now I have looked around here a little and I found a post saying that I needed to install the latest version of NumPy, but when I go to do that, I get back this:
Requirement already satisfied: NumPy in c:\users\username\appdata\local\continuum\anaconda3\envs\cntk-py34\lib\site-packages
SO I really have no idea what is going on here.
Anyway, thanks in advance.
Is your IDE linked to Anaconda env? If you open up the Anaconda prompt and import numpy do you get the same error?
You probably have an environment outside of Anaconda which does not have numpy installed.
In my case, I was executing [filename].py from the Anaconda prompt as I would a batch file and was getting this error. I confirmed numpy was install by executing pip list.
Funning python and passing the script file name as an argument, eg python [filename].py, correctly imported the numpy module and executed the script without error.

Jupyter Notebook Packages Won't Import

I've searched around for a while, and I've tried many things such as
conda create -n ipykernel_py3 python=3 ipykernel
source activate ipykernel_py3 # On Windows, remove the word 'source'
python -m ipykernel install --user
Uninstalling and reinstall both Python3 and Anaconda3. All I want is for Jupyter Notebook to be able to use libraries in Anaconda. If I change my environment to root via
activate root
I can open Jupyter notebook, however when I do
activate ipykernel_py3
and then try to do
jupyter notebook
I get the error
Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2
When I open Jupyter notebook and input
import os
os.getcwd()
I get
'C:\Users\Mike\Documents\Mathematical Modeling'
and Anaconda is in
'C:\ProgramData\Anaconda3'
The problem is when I do
import numpy
I get this error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-5a0bd626bb1d> in <module>()
----> 1 import numpy
ModuleNotFoundError: No module named 'numpy'
--------------------------------------EDIT--------------------------------------
I've just uninstalled anaconda, and am currently reinstalling it. For some reason I was unable to install other packages to my ipykernel_py3 environment. Hopefully I figure something out.
The solution after countless re-installations of anaconda, and working with environments, is this
Go to start menu->
View Advanced System Settings->Environment Variables
highlight the variable that has name 'Path'
Click edit
Change variable value to 'C:\Users\Mike\Anaconda3\Scripts'
Of course my directory will be different from anyone else's, but this solved all my problems.

ImportError: No module named theano.sandbox using Jupyter notebook

I am trying to work with Keras on some small datasets locally, using my cpu.
I started a jupyter notebook, and selected what I think might be the right kernel, which would be the conda env:tensorflow:
So I try to import from the sandbox:
from theano.sandbox import cuda .
and I get
ImportError: No module named theano.sandbox
I don't get it. Theano is installed. Tensorflow is installed. Anaconda is installed. How can I figure out what is going on?

Resources