How to solve ImportError: dlopen(): Symbol not found:.... Expected in: flat namespace
Asked Answered
S

6

14

Can anyone help me solve this issue?

ImportError: dlopen(/Users/......./venv/lib/python3.6/site-packages/recordclass/mutabletuple.cpython-36m-darwin.so, 2): Symbol not found: __PyEval_GetBuiltinId
  Referenced from: /Users/......./venv/lib/python3.6/site-packages/recordclass/mutabletuple.cpython-36m-darwin.so
  Expected in: flat namespace
 in /Users/......../venv/lib/python3.6/site-packages/recordclass/mutabletuple.cpython-36m-darwin.so

I'm using a Mac if that's of any relevance

Sportsmanship answered 19/3, 2020 at 16:22 Comment(0)
S
14

I couldn't quite figure out what the issue was but I'm assuming __PyEval_GetBuiltinId was broken/uninstalled.
So all I did to fix this was pip uninstall recordclass and then pip install --no-cache-dir recordclass and it seemed to have worked

Sportsmanship answered 22/3, 2020 at 9:12 Comment(0)
W
5

I encountered the same problem and found your question. I have an M1 MacBook, but I think we're encountering 2 problems. At first, I had a similar error to yours:

ImportError> dlopen(): Library not found

What I did to fix this error was 'brew install ___' the library that was missing, in my case it was tesseract. After I brew installed it again I ran my script and got a new error. This time I had a

no suitable image found: imageXXX found but wrong architecture

So what I think may be happening is there is an underlying error with the compatibility between our M1 chips and the brew install-ed formulaes. I'm currently trying to find a solution. The first I'm going to try is resetting my installation from scratch and, if that doesn't work, look at alternatives. Ultimately I think what will solve the problem is installing from source like is described on the OpenCV website: https://docs.opencv.org/master/d0/db2/tutorial_macos_install.html.

Hope this helped!

EDIT I just finished uninstalling Homebrew completely and the reinstalling it from scratch, both casks, formulae, EVERYTHING! And it seems to work. I got both Tensorflow and OpenCV to work (they both printed their versions and I ran a simple camera test on OpenCV)

Weald answered 18/8, 2021 at 21:12 Comment(0)
D
1

This issue is well described here. I had the same issue with the NetCDF4 library in the macOS M1 chip. In my case ([email protected]) installing the library using brew and pip didn't solve the problem as the provided package wasn't compatible with the M1 chip. The issue will solve as mentioned in their Github in [email protected].

In such cases, I recommend:

First make sure that you install dependencies of the library (in this case recordclass) that you are using in your system in case you are using a virtual environment, not just in the environment.

Second check if the wheel of the library meets your machine requirements.

Dedicate answered 14/5, 2022 at 23:47 Comment(0)
S
0

In my case, this happened on an M2 Mac Mini and on mysqlclient package. After going through various suggestions from here on SO, the one that worked for me was the following steps:

Check which version was used by the python of the system host:

% python3 --version
Python 3.11.1

Check version used by virtualenv: (venv) % python3 --version Python 3.9.13

So the virtualenv was using a different python version. I removed the virtualenv and installed a new virtualenv with the same version as host system:

python3.11 -m venv venv

After that, on reinstalling the packages which causes problems, it worked.

Obviously this is not a solution if you wish to use a different python version than the one in your system, which is usually the case when you resort to using a virtualenv.

Spahi answered 21/5, 2023 at 4:10 Comment(0)
L
0

Same here, I just downgrade to python 3.8.16

Lussier answered 10/7, 2023 at 8:8 Comment(0)
I
0

I have multiple Python installations on my M1 MacBook Pro: homebrew and anaconda3. I'm working on a Jupyter Notebook in VS code. I just reopened a notebook, which is set to use the Anaconda environment. Suddenly, I got the message "no suitable image found" on import pandas pd, of all things.

I switched from Anaconda to Homebrew, ran my imports there, and then switched back to Anaconda, and it worked.

Igal answered 30/5 at 1:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.