anaconda / anaconda-project

Tool for encapsulating, running, and reproducing data science projects
https://anaconda-project.readthedocs.io/en/latest/
Other
216 stars 88 forks source link

[BUG] Platform Incorrect in MacOS Rossetta2 Terminal #361

Closed william-silversmith closed 2 years ago

william-silversmith commented 2 years ago

ALL software version info

(conda 4.9.2, cpython 3.8.12, MacOS 12.2)

Description of expected behavior and the observed behavior

On an Apple Silicon M1 laptop with miniconda installed, the platform is detected as arm64 when in virtualenv it is detected as x86_64. This causes python wheels to be built as arm64 and fail.

See https://gitlab.com/jfolz/simplejpeg/-/issues/14 for more details.

Complete, minimal, self-contained example code that reproduces the issue

Open a terminal window with Rosetta2 enabled.

$ conda create -n simplejpeg38 python=3.8
$ conda activate simplejpeg38
$ pip install simplejpeg38 
$ python
>>> import simplejpeg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/USER/code/simplejpeg/simplejpeg/__init__.py", line 1, in <module>
    from ._jpeg import encode_jpeg
ImportError: dlopen(/Users/USER/code/simplejpeg/simplejpeg/_jpeg.cpython-38-darwin.so, 2): Symbol not found: _tjCompress2
  Referenced from: /Users/USER/code/simplejpeg/simplejpeg/_jpeg.cpython-38-darwin.so
  Expected in: flat namespace
 in /Users/USER/code/simplejpeg/simplejpeg/_jpeg.cpython-38-darwin.so

However this sequence fixes the issue:

$ conda create -n simplejpeg38 python=3.8
$ conda activate simplejpeg38
$ arch -arm64 pip install simplejpeg38 
$ python
>>> import simplejpeg

Anaconda:

>>> import platform
>>> platform.platform()
'macOS-12.2-arm64-i386-64bit'

Virtualenv:

>>> import platform
>>> platform.platform()
'macOS-12.2-x86_64-i386-64bit'
jbednar commented 2 years ago

anaconda-project is a command-line tool for capturing reproducible projects, based on conda but distinct from it. Here it doesn't look like you are using anaconda-project, so it seems like a potential issue with conda to report at https://github.com/conda/conda/issues instead.

william-silversmith commented 2 years ago

Thanks sorry, I wasn't sure what the distinctions were. I should have done more research. Thanks for the link!