Closed Ayrtonalec closed 5 years ago
It seems like the setup script cannot find mapnik-config
in PATH
.
AttributeError: 'module' object has no attribute 'Map'
Don't you have mapnik.py
file in the directory from where you do the import mapnik
? Python then imports your mapnik.py
instead of system mapnik
module.
AttributeError: 'module' object has no attribute 'Map'
Don't you have
mapnik.py
file in the directory from where you do theimport mapnik
? Python then imports yourmapnik.py
instead of systemmapnik
module.
First of all, thank you for the quick response! You were absolutely right there, rookie mistake. Still under the new year aftermath effect, I suppose. :(
Renamed the file and I still get the same error though, except not in import mapnik
but after I have imported mapnik and try to use m = mapnik.Map(600,300)
.
Stack trace:
Traceback (most recent call last):
File "mapnik_server.py", line 1, in <module>
import mapnik
File "/home/ec2-user/environment/tile-server-s/temp/mapnik.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'Map'
My file: (literally jus those two lines of code)
import mapnik
m = mapnik.Map(600,300) # create a map with a given width and height in pixels
Do you have any idea what might cause this?
I think it is still the same problem, it seems like it imports some /home/ec2-user/environment/tile-server-s/temp/mapnik.py
.
There was another file called mapnik.pyc indeed. Apparently, it is created when someone uses the test command:
python -c "import mapnik;print mapnik.__file__" # should return the path to the python bindings and no errors
It is working as it is supposed to now. Thank you for your help and the best wishes for 2019!
When I try to run setup.py with the command
sudo python setup.py install
I keep running into the following error:Does anyone know what is exactly causing this and how to fix it?
The reason I'm going for this approach is that
sudo python pip install mapnik
end up with an import failure of mapnik. I'll also link the stack trace of this error in case if it could help the issue in any way. The traceback fromimport mapnik
with the regularsudo python pip install mapnik
is:I run the following versions: Python: Python 2.7.14 (default, May 2 2018, 18:31:34) OS: CentOS6 on AmazonAWS ec2 instance (editing the code in their cloud9) installed mapnik version: 3.0.0-pre (mapnik-config -v)