[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #EOQ-833825]: Error (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))



Hello,

The root of this issue is that the interpreter is trying to invoke libraries 
built for the x86_64 architecture.  There are a couple of potential causes for 
this.  First, homebrew may have installed x86_64-compiled libraries.  I am not 
terribly familiar with homebrew, but it's possible that they may only provide 
binaries for the Intel architecture, or that a command-line argument is 
required when installing packages, in order for M1-compatible binaries to be 
installed.  It's also possible that PyCharm is not properly set to invoke 
libraries using Rosetta2.

Looking at the page you linked, it does not seem to specify using homebrew 
specifically.  You might also have better luck installing using Conda, as 
linked from the page at https://unidata.github.io/netcdf4-python.  Are you able 
to easily install the dependencies from a different source, and see if the 
issue changes or goes away?

-Ward



> Hi,
> 
> My name is Raul Gerru and I am not sure if my problem is an issue or simply I 
> am doing something wrong. I have the following problem:
> 
> I am working in PyCharm, with a python 3.10 interpreter in a new MacBook Pro 
> with an M1 pro chip. I have loaded the netcdf4 module (and all the other 
> necessary libraries described in https://unidata.github.io/netcdf4-python/, 
> specifically, NetCDF and hdf5 with the Home-brew installer). When I try to 
> `import netCDF4´, the following error appears:
> 
> `Traceback (most recent call last):
> File 
> "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/code.py", 
> line 90, in runcode
> exec(code, self.locals)
> File "<input>", line 1, in <module>
> File 
> "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py",
>  line 198, in runfile
> pydev_imports.execfile(filename, global_vars, local_vars)  # execute the 
> script
> File 
> "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py",
>  line 18, in execfile
> exec(compile(contents+"\n", file, 'exec'), glob, loc)
> File 
> "/Users/raulgerru/PycharmProjects/FELTOR_FINAL/src/feltor/Vorticity_Equation_analysis.py",
>  line 19, in <module>
> import netCDF4 as nc
> 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/raulgerru/PycharmProjects/venv/lib/python3.10/site-packages/netCDF4/__init__.py",
>  line 3, in <module>
> from ._netCDF4 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/raulgerru/PycharmProjects/venv/lib/python3.10/site-packages/netCDF4/_netCDF4.cpython-310-darwin.so,
>  0x0002): tried: 
> '/Users/raulgerru/PycharmProjects/venv/lib/python3.10/site-packages/netCDF4/_netCDF4.cpython-310-darwin.so'
>  (mach-o file, but is an incompatible architecture (have 'x86_64', need 
> 'arm64e')), '/usr/lib/_netCDF4.cpython-310-darwin.so' (no such file)
> `
> 
> I hope you can help me with my problem,
> 
> Best regards,
> 
> Raul Gerru
> 
> 


Ticket Details
===================
Ticket ID: EOQ-833825
Department: Support netCDF
Priority: Normal
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.