0

I am trying to get osmnx to work on my Macbook. I have installed it using

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx

and I am able to type

conda activate ox

to activate the environment. However, when running the code, I always get the error message

import osmnx as ox
ModuleNotFoundError: No module named 'osmnx'

I feel like I have tried everything there is on this topic in other questions, but it seems like the answers maybe only work on Windows? I am totally new to all of this, so maybe someone can help me...

tripleee
  • 175,061
  • 34
  • 275
  • 318
lavarsovie
  • 11
  • 2

1 Answers1

0

You have created a new environment ox but the python interpreter cannot find the package in the environment path.

You can check if your desired package is installed by running conda list after activating the environment in the terminal.

Saatvik Ramani
  • 392
  • 3
  • 8
  • Thank you for your answer! I did as you said, and `osmnx 1.1.1 pyhd8ed1ab_0 conda-forge` is listed in the long output list after running `conda list`. To my understanding this means that the package should be there... – lavarsovie Jun 16 '21 at 08:58
  • Can you run `import sys print(sys.path)`and check if the python path points to the conda environment? @lavarsovie – Saatvik Ramani Jun 16 '21 at 09:01
  • I am not sure if I did it correctly, I did run exactly what you wrote in the terminal after activating the environment and I got this error: `zsh: unknown file attribute: y` – lavarsovie Jun 16 '21 at 10:14
  • My bad, should've mentioned running it inside a python terminal. After activating the environment, run `python` to initialize a python terminal and then run `import sys; print(sys.path)` – Saatvik Ramani Jun 16 '21 at 10:22
  • Ah sorry, got it now...among others I get a path that points to some .egg file in my python3.8/site-packages directory – lavarsovie Jun 16 '21 at 10:24
  • These are the paths: ['', '/Users/name/opt/anaconda3/envs/ox/lib/python39.zip', '/Users/name/opt/anaconda3/envs/ox/lib/python3.9', '/Users/name/opt/anaconda3/envs/ox/lib/python3.9/lib-dynload', '/Users/name/opt/anaconda3/envs/ox/lib/python3.9/site-packages'] I looked for a folder named osmnx in my anaconda-directory and as a result I get two such folders, but none of them are located in the paths that I get when running the `import sys...` command in python.. maybe that is the problem – lavarsovie Jun 16 '21 at 10:31
  • Yea I'd try reinstalling the package using conda/pip and verifying if it installs in your environment. – Saatvik Ramani Jun 16 '21 at 10:48