marceloprates / prettymaps

A small set of Python functions to draw pretty maps from OpenStreetMap data. Based on osmnx, matplotlib and shapely libraries.
GNU Affero General Public License v3.0
11.12k stars 522 forks source link

Installing Issues with conda on Mac OS #107

Closed finnharbeke closed 1 year ago

finnharbeke commented 1 year ago

Hey I just found this project today and it seems great but I can't get it to work.

I'm using conda on mac os, and i tried mulitple different approaches to make an environment for prettymaps:

The way I'm used to would be conda create -n prettymaps python, conda activate and then, according to the readme, pip install git+https://github.com/marceloprates/prettymaps.

But this way when I run python or a jupyter notebook, I get a ModuleNotFoundError: No module named 'prettymaps' even though prettymaps is in conda list.

I've also tried installing all dependencies before installing prettymaps and different osmnx versions (when resolvable), but it always ended in the same manner.

When installing with PyPI I can import prettymaps but when running prettymaps.plot I get two deprecation warnings (pandas: frame.append and shapely: iteration over multi-part geometries), and then a AttributeError: 'NoneType' object has no attribute 'axis' from line 251 in prettymaps/draw.py.

I don't know if I'm doing something wrong about installing the package from github, or it's because of the current dependency conflict with vsketch. How can I install prettymaps so that it works?

(hope it's fine to open this as an issue, I'll close it as soon as I found a solution)

lukasbeuster commented 1 year ago

"But this way when I run python or a jupyter notebook, I get a ModuleNotFoundError: No module named 'prettymaps' even though prettymaps is in conda list." - the same issue here. Looking for pointers on how to solve this :)

FGarridoV commented 1 year ago

Same here. I also installed directly from GitHub and pip.

ModuleNotFoundError: No module named 'prettymaps'

I could make it works in Colab, but with a lot of warnings. I hope the dependencies issues can be solved soon!

marceloprates commented 1 year ago

Sorry for the delay. I postponed releasing a new version due to compatibility issues with vsketch I was trying to solve. In theory you should be able to install prettymaps directly from pip now. I've tested it on my machine, but I still cannot install it from pip on Google Colab (it works however if you install directly from github there: !pip install -e "git+https://github.com/marceloprates/prettymaps#egg=prettymaps")

Can you try installing directly from pip and tell me if it works?

pip install prettymaps==0.1.8

marceloprates commented 1 year ago

I'm not sure why this is happening, but now for some reason when I try installing prettymaps on my machine using pip it installs it without errors but then I can't import prettymaps (module not found). pip installs prettymaps' dependencies normally though, and I can import them normally..

marceloprates commented 1 year ago

OK, I think the problem was related with the path specified in the package_dir argument for the setup() function in setup.py. After I changed it from

package_dir={'prettymaps': '.'}

to

package_dir={'prettymaps': 'prettymaps'}

I could install & import prettymaps without errors again. @finnharbeke , @lukasbeuster, @FGarridoV , could you please try installing prettymaps from pip like this:

$ pip install prettymaps==0.2b2

and test importing the package like this?

import prettymaps; print(dir(prettymaps))

It should print the following:

['Subplot', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'create_preset', 'delete_preset', 'draw', 'fetch', 'multiplot', 'plot', 'preset', 'presets']

If you can successfully install & import prettymaps, I'll release v0.2 as the next stable version. Thanks!

finnharbeke commented 1 year ago

That's it! Installing with pip worked perfectly now, no warnings either.

marceloprates commented 1 year ago

Awesome, thanks!