1

I'm trying to run a 3rd party application through the Spyder Python IDE. I'm able to import the code and it runs through the command line using the Terminal application but Spyder appears to be more careful about code signing permissions, and it won't run the code. The initial error said that the code wasn't signed at all. The error was

'/path/libmylibrary.dylib' not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.)

By entering codesign -d -v /path/libmylibrary.dylib I was able to see the code signing status, which said that, indeed, the code was unsigned. I then signed the code by entering codesign -s - /path/libmylibrary.dylib and the code was then signed. However, there were still problems. Running at this point led to the new error

'/path/libmylibrary.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)

Sure enough, it's still correct. The library TeamIdentifier is still equal to "not set". But here, I'm stuck. I can't seem to find any way to set this value to anything else. Any advice on how to fix this would be much appreciated.

Details: Computer is a 2022 M1 MacBook Pro running OS 12.6 and Spyder is version 5.3.3. Spyder says that it's running Python 3.9.5, but if I run Python from the command line, then it's version 3.10.

5
  • First thing to do is get them running the same python - venv is useful for that. The code you are having problems with is not python code so what is it and how was it installed?
    – mmmmmm
    Nov 4, 2022 at 19:17
  • @mmmmmm I suspect that the Python version is not the issue but it's a good point and I'll work on that. Anyhow, the code is libantimony.dylib, which I installed as part of a large package, which I installed with pip install tellurium. I expect that libantimony.dylib was written in C++ but I don't really know. Nov 4, 2022 at 19:43
  • Well the pip does need to match the python version
    – mmmmmm
    Nov 4, 2022 at 20:15
  • @mmmmmm I agree, and that may well be the source of the problem. However, I'm still wondering if there's a way to set the Team ID when code-signing. Nov 4, 2022 at 22:20
  • In that cas I would make a separate question for just that (or edit this down to just ask about this) The python parts sort of make this a different question
    – mmmmmm
    Nov 5, 2022 at 8:51

1 Answer 1

0

I finally fixed the problem. @mmmmmm was correct that the issue had to do with Python versions and not with code signing at all.

In Spyder, set the library directories with Tools/PYTHONPATH manager. I unselected the Spyder.app path because that was causing conflicts with my user path. I found which user path I wanted by starting Python in a command line, importing a file, and entering myfile.__file__.

Also, set the Python version in Spyder with Preferences/Python interpreter. I found which Python I wanted by entering which python in the command line. Spyder shows what Python you're using at the bottom of the window.

Finally, I needed to restart Spyder for these changes to take effect. I never touched code signing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .