Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Expected in: flat namespace occuring out of the blue #1034

Open
shitathakin opened this issue Mar 21, 2022 · 8 comments
Open

Error: Expected in: flat namespace occuring out of the blue #1034

shitathakin opened this issue Mar 21, 2022 · 8 comments
Labels
help wanted installation-issues Issue related to installation problems. macos Issue related to MacOS

Comments

@shitathakin
Copy link

Hi. When I download pyproj (MAC M1 chip, Big Sur 11.0.1) on python in a VENV folder it works originally then always seems to come up with the following error:

Traceback (most recent call last):
  line 3, in <module>
  File "/Users/jackbarrett/Documents/Uni/2022sem1/Spatial info programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/__init__.py", line 49, in <module>
    import pyproj.network
  File "/Users/jackbarrett/Documents/Uni/2022sem1/Spatial info programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/network.py", line 10, in <module>
    from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
[ImportError: dlopen(/Users/jackbarrett/Documents/Uni/2022sem1/Spatial info programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/_network.cpython-38-darwin.so, 2): Symbol not found: _proj_context_is_network_enabled](https://www.google.com/search?q=python%20ImportError:%20dlopen(/Users/jackbarrett/Documents/Uni/2022sem1/Spatial%20info%20programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/_network.cpython-38-darwin.so,%202):%20Symbol%20not%20found:%20_proj_context_is_network_enabled)
  Referenced from: /Users/jackbarrett/Documents/Uni/2022sem1/Spatial info programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/_network.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/jackbarrett/Documents/Uni/2022sem1/Spatial info programming/code/A1(current)/venv/lib/python3.8/site-packages/pyproj/_network.cpython-38-darwin.so

Really frustrating me, any ideas. Thanks. I have the latest proj downloaded with brew and pyproj via pip

@snowman2 snowman2 added help wanted macos Issue related to MacOS labels Mar 21, 2022
@snowman2
Copy link
Member

Likely related: #1027

@snowman2
Copy link
Member

Can you try creating a new python virtual environment and:

brew install proj
python -m pip install pyproj

@snowman2 snowman2 added installation-issues Issue related to installation problems. and removed bug labels Apr 23, 2022
@jannismain
Copy link

I'm hitting the same issue using PyPy 7.3.8

$ pip install pyproj
Collecting pyproj
  Using cached pyproj-3.3.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Collecting certifi
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Installing collected packages: certifi, pyproj
Successfully installed certifi-2021.10.8 pyproj-3.3.1
$ python
Python 3.9.10 (8276b505180f70c5784a698a510f0a17317a85c3, Feb 19 2022, 16:51:03)
[PyPy 7.3.8 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pyproj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/__init__.py", line 49, in <module>
    import pyproj.network
  File "/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/network.py", line 10, in <module>
    from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
ImportError: dlopen(/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/_network.pypy39-pp73-darwin.so, 0x0006): symbol not found in flat namespace '_proj_context_is_network_enabled'

Otherwise works fine under CPython 3.10.4. Also, I'm on an M1 Mac.

@snowman2
Copy link
Member

That's not good that pip is downloading an x86_64 wheel on a Mac M1: pyproj-3.3.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl. I am thinking that this is an issue with pip.

@jannismain
Copy link

Yes, I also wondered about that.

So next step would be to ignore the wheel, right?

pip install pyproj --no-binary :all:

I'm getting a weird ascii decode error within pip, so I disable PEP517 for legacy build behaviour:

$ pip install pyproj --no-binary :all: --no-use-pep517
Collecting pyproj
  Using cached pyproj-3.3.1.tar.gz (219 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: certifi in /Users/mkj/.pyenv/versions/pypy3.9-7.3.8/envs/atria-pypy/lib/pypy3.9/site-packages (from pyproj) (2021.10.8)
Skipping wheel build for pyproj, due to binaries being disabled for it.
Installing collected packages: pyproj
  Running setup.py install for pyproj ... done
Successfully installed pyproj-3.3.1

However I'm hitting the same issue as before:
ImportError ... pyproj/_network.pypy39-pp73-darwin.so, 0x0006): symbol not found in flat namespace '_proj_context_is_network_enabled'

@snowman2
Copy link
Member

However I'm hitting the same issue as before

Did you try this process in a new python environment?

@jannismain
Copy link

yes, here are the commands I used:

$ pyenv virtualenv pypy3.9-7.3.8 env
$ pyenv shell env
(env) $ pip install cython
Collecting cython
  Using cached Cython-0.29.28-py2.py3-none-any.whl (983 kB)
Installing collected packages: cython
Successfully installed cython-0.29.28
(env) $ pip install pyproj --no-binary :all: --no-use-pep517
Collecting pyproj
  Using cached pyproj-3.3.1.tar.gz (219 kB)
  Preparing metadata (setup.py) ... done
Collecting certifi
  Downloading certifi-2021.10.8.tar.gz (151 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.2/151.2 kB 2.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Skipping wheel build for pyproj, due to binaries being disabled for it.
Skipping wheel build for certifi, due to binaries being disabled for it.
Installing collected packages: certifi, pyproj
  Running setup.py install for certifi ... done
  Running setup.py install for pyproj ... done
Successfully installed certifi-2021.10.8 pyproj-3.3.1
(env) $ python
Python 3.9.10 (8276b505180f70c5784a698a510f0a17317a85c3, Feb 19 2022, 16:51:03)
[PyPy 7.3.8 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pyproj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/__init__.py", line 49, in <module>
    import pyproj.network
  File "/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/network.py", line 10, in <module>
    from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
ImportError: dlopen(/Users/mkj/.pyenv/versions/atria-pypy2/lib/pypy3.9/site-packages/pyproj/_network.pypy39-pp73-darwin.so, 0x0006): symbol not found in flat namespace '_proj_context_is_network_enabled'

@dusvyat
Copy link

dusvyat commented Jun 30, 2022

Any solution to this? I am running into same issue with Mac M1 Monterey

import pyproj

Traceback (most recent call last):
  File "/Users/d/PycharmProjects/nugen-core/nugen-zehs-haulroutes/venv/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3397, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-3-98cb605ea9de>", line 1, in <cell line: 1>
    import pyproj
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/d/PycharmProjects/nugen-core/nugen-zehs-haulroutes/venv/lib/python3.9/site-packages/pyproj/__init__.py", line 49, in <module>
    import pyproj.network
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/d/PycharmProjects/nugen-core/nugen-zehs-haulroutes/venv/lib/python3.9/site-packages/pyproj/network.py", line 10, in <module>
    from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: dlopen(/Users/d/PycharmProjects/nugen-core/nugen-zehs-haulroutes/venv/lib/python3.9/site-packages/pyproj/_network.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_proj_context_is_network_enabled'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted installation-issues Issue related to installation problems. macos Issue related to MacOS
Projects
None yet
Development

No branches or pull requests

4 participants