python-mapnik icon indicating copy to clipboard operation
python-mapnik copied to clipboard

cant install on ubuntu 16.04

Open skasberger opened this issue 7 years ago • 7 comments

after executing the installation as stated in README.md, the module can not be imported into python, throwing the following error.

python -c "import mapnik"          
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/my-data/apps/python-mapnik/mapnik/__init__.py", line 74, in <module>
    from ._mapnik import *
ImportError: /my-data/apps/python-mapnik/mapnik/_mapnik.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyClass_Type

/my-data/apps/python-mapnik is the folder in which i cloned the repo.

i run

  • ubuntu 16.04
  • Python 3.6.3 :: Anaconda custom (64-bit)
  • mapnik 3.1.0

skasberger avatar Dec 04 '17 12:12 skasberger

I'm having a similar issue, my log looks like:

 python3.6 -c "import mapnik; print(mapnik.__file__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/mapnik-0.1-py3.6-linux-x86_64.egg/mapnik/__init__.py", line 74, in <module>
    from ._mapnik import *
ImportError: /usr/local/lib/python3.6/dist-packages/mapnik-0.1-py3.6-linux-x86_64.egg/mapnik/_mapnik.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyString_Type
  • I've installed mapnik from source and pyhon-mapnik following some info found here

I also have the python3.5 debian packages that works just fine, but I need to use it with my code which is in a py3.6 env.

Above was on ubuntu 16.04, xenial.

On latest ubuntu zesty from official repo I have:

Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/mapnik/__init__.py", line 74, in <module>
    from ._mapnik import *
ImportError: /usr/lib/python3/dist-packages/mapnik/_mapnik.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZTIN6mapnik15freetype_engineE
>>>

Any clue on how to fix this?

epifanio avatar Jan 22 '18 09:01 epifanio

I have exactly same problems.

xtompok avatar Feb 03 '18 13:02 xtompok

Hello guys !

Which version of g++ are you running ?

Try to upgrade g++ to version 7.2.0, then build again mapnik and python-mapnik from sources. Also be sure to choose the correct branches after cloning the repositories. I assume the latest stable release of mapnik is v.3.0.16, then before building you should do :

  • git checkout v3.0.16 (for mapnik)
  • git checkout v3.0.x (for python-mapnik)

In my case, it actually solved the exact same problem as @epifanio / @xtompok mentionned

Djoow avatar Feb 10 '18 18:02 Djoow

With the GCC-7.2 problem changes to https://github.com/mapnik/python-mapnik/issues/103 :-( I am building against self-compiled mapnik from Git.

xtompok avatar Feb 11 '18 20:02 xtompok

Check whether you have the latest version of Boost for python (run apt update && apt install libboost-python-dev Then try to do export BOOST_PYTHON_LIB=boost_python and re-build python-mapnik

Djoow avatar Feb 11 '18 22:02 Djoow

When i do export BOOST_PYTHON_LIB=boost_python, build the python-mapnik (python setup.py develop) and then try to import mapnik, it ends with 'ImportError: .../python-mapnik4/mapnik/_mapnik.cpython-35m-x86_64-linux-gnu.so: undefined symbol: PyString_Type`

xtompok avatar Feb 12 '18 07:02 xtompok

@Djoow Hi, What If we chackout both master branches ?I could not build any other branches but the masters works fine. but 'import mapkin' command in python throws error

am2222 avatar Feb 19 '19 15:02 am2222