pydantic package ImportError (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - pydantic

my system: macos Ventura 13.0
CPU: AppleM2
python: 3.10.0
heroku: heroku/7.67.1 darwin-x64 node-v14.19.0
pydantic: 1.10.2
when i run command "heroku local web", i got the error, apple m2 is ARM arch, why the error is "need x86_64"? if someone meet the problem, how can i fix it?
9:19:25 PM web.1 | from fastapi import params
9:19:25 PM web.1 | File "/Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-MQQZRb-z-py3.11/lib/python3.11/site-packages/fastapi/params.py", line 4, in <module>
9:19:25 PM web.1 | from pydantic.fields import FieldInfo, Undefined
9:19:25 PM web.1 | ImportError: dlopen(/Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-MQQZRb-z-py3.11/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so, 0x0002): tried: '/Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-MQQZRb-z-py3.11/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-M
9:19:25 PM web.1 | > QQZRb-z-py3.11/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so' (no such file), '/Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-MQQZRb-z-py3.11/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
[DONE] Killing all processes with signal SIGINT
9:19:25 PM web.1 Exited with exit code null
poetry show:
alembic 1.8.1 A database migration tool for SQLAlchemy.
amqp 5.1.1 Low-level AMQP client for Python (fork of amqplib).
anyio 3.6.2 High level compatibility layer for multiple asynchronous event loop implementations
asgiref 3.5.2 ASGI specs, helper code, and adapters
async-timeout 4.0.2 Timeout context manager for asyncio programs
asyncpg 0.27.0 An asyncio PostgreSQL driver
attrs 22.1.0 Classes Without Boilerplate
billiard 3.6.4.0 Python multiprocessing fork with improvements and bugfixes
black 22.12.0 The uncompromising code formatter.
celery 5.2.7 Distributed Task Queue.
certifi 2022.12.7 Python package for providing Mozilla's CA Bundle.
click 8.1.3 Composable command line interface toolkit
click-didyoumean 0.3.0 Enables git-like *did-you-mean* feature in click
click-plugins 1.1.1 An extension module for click to enable registering CLI commands via setuptools entry-points.
click-repl 0.2.0 REPL plugin for Click
fastapi 0.86.0 FastAPI framework, high performance, easy to learn, fast to code, ready for production
fastapi-camelcase 1.0.5 Package provides an easy way to have camelcase request/response bodies for Pydantic
flake8 3.9.2 the modular source code checker: pep8 pyflakes and co
gevent 22.10.2 Coroutine-based network library
greenlet 2.0.1 Lightweight in-process concurrent programming
h11 0.14.0 A pure-Python, bring-your-own-I/O implementation of HTTP/1.1
httpcore 0.16.2 A minimal low-level HTTP client.
httptools 0.5.0 A collection of framework independent HTTP protocol utils.
httpx 0.23.1 The next generation HTTP client.
idna 3.4 Internationalized Domain Names in Applications (IDNA)
iniconfig 1.1.1 iniconfig: brain-dead simple config-ini parsing
kombu 5.2.4 Messaging library for Python.
mako 1.2.4 A super-fast templating language that borrows the best ideas from the existing templating languages.
markupsafe 2.1.1 Safely add untrusted strings to HTML/XML markup.
mccabe 0.6.1 McCabe checker, plugin for flake8
mypy-extensions 0.4.3 Experimental type system extensions for programs checked with the mypy typechecker.
packaging 22.0 Core utilities for Python packages
pathspec 0.10.3 Utility library for gitignore style pattern matching of file paths.
platformdirs 2.6.0 A small Python package for determining appropriate platform-specific dirs, e.g. a "user data dir".
pluggy 1.0.0 plugin and hook calling mechanisms for python
prompt-toolkit 3.0.36 Library for building powerful interactive command lines in Python
pycodestyle 2.7.0 Python style guide checker
pycountry 22.3.5 ISO country, subdivision, language, currency and script definitions and their translations
pydantic 1.10.2 Data validation and settings management using python type hints
pyflakes 2.3.1 passive checker of Python programs
pyhumps 3.8.0 🐫 Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by Humps for Node
pytest 7.2.0 pytest: simple powerful testing with Python
python-dotenv 0.21.0 Read key-value pairs from a .env file and set them as environment variables
python-json-logger 2.0.4 A python library adding a json log formatter
pytz 2022.6 World timezone definitions, modern and historical
pyyaml 6.0 YAML parser and emitter for Python
redis 4.4.0 Python client for Redis database and key-value store
rfc3986 1.5.0 Validating URI References per RFC 3986
setuptools 65.6.3 Easily download, build, install, upgrade, and uninstall Python packages
six 1.16.0 Python 2 and 3 compatibility utilities
sniffio 1.3.0 Sniff out which async library your code is running under
sqlalchemy 1.4.45 Database Abstraction Library
starlette 0.20.4 The little ASGI library that shines.
typing-extensions 4.4.0 Backported and Experimental Type Hints for Python 3.7+
uvicorn 0.19.0 The lightning-fast ASGI server.
uvloop 0.17.0 Fast implementation of asyncio event loop on top of libuv
vine 5.0.0 Promises, promises, promises.
watchfiles 0.18.1 Simple, modern and high performance file watching and code reload in python.
wcwidth 0.2.5 Measures the displayed width of unicode strings in a terminal
websockets 10.4 An implementation of the WebSocket Protocol (RFC 6455 & 7692)
zope-event 4.6 Very basic event publishing system
zope-interface 5.5.2 Interfaces for Python
i execute the code:
python3 -c "import pydantic.utils; print(pydantic.utils.version_info())"
output:
pydantic version: 1.10.2
pydantic compiled: True
install path: /Users/wj/Library/Caches/pypoetry/virtualenvs/fuse-hotel-MQQZRb-z-py3.11/lib/python3.11/site-packages/pydantic
python version: 3.11.0 (v3.11.0:deaf509e8f, Oct 24 2022, 14:43:23) [Clang 13.0.0 (clang-1300.0.29.30)]
platform: macOS-13.0-arm64-arm-64bit
optional deps. installed: ['dotenv', 'typing-extensions']

Related

Georasters: RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd

I have made an environment based on ArcGIS Pro, which has
Python 3.7.10,
arcpy 2.8,
arcgispro 2.8,
gdal 2.3.3
I need to use georasters, but I do not know which version to install. I tried installing the default and now I have, georaster 0.5.15. However, whenever I import the library, I end up getting
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
I searched it online wherein they suggested to upgrade numpy, but when I did that, the whole environments stopped working. What should I do? I am planning to downgrade numpy and georasters, but I do know which version to use.

Which version of protoc should I need?

When I ran the gem5 in a server, the error appeared.
[libprotobuf FATAL google/protobuf/stubs/common.cc:68] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.4.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "build/X86_MESI_Two_Level/proto/inst_dep_record.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 3.4.0. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "build/X86_MESI_Two_Level/proto/inst_dep_record.pb.cc".)
Aborted (core dumped)
According to the error information, I need version 3.5.0 of libprotobuf. But when I ran the command protoc --version, The output is "libprotoc 3.5.0" which shows that I already have version 3.5.0.
The same code can be run in another server. I run the command protoc --version in that server. It shows
"libprotoc 2.6.1".

tensorflow on tx2 protobuf

Hi i have installed tensorflow using
https://devtalk.nvidia.com/default/topic/1038957/jetson-tx2/tensorflow-for-jetson-tx2-/post/5278617/#5278617
when i run the python script i get the following error:
libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.5.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf_archive/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
pip show protobuf i get Version: 3.6.1
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf#googlegroups.com
Author-email: protobuf#googlegroups.com
License: 3-Clause BSD License
Location: /home/nvidia/vitualenv/lib/python2.7/site-packages
Requires: setuptools, six
Required-by: tensorflow-gpu, tensorboard
someone have some ideas how to solve this?
Thanks
Finally i got it worked. In the end i have to import tensorflow at the beginning of the python file. No other solution worked for me except this one.
I do not understand why.
If someone know the answer can you please explain me why?
Thanks

web2py cannot import pymysql 0.9.2 : No module named cryptography.hazmat.backends

I installed web2py in Windows using web2py.exe. When I try to update pymysql using 0.9.2, I got this error "No module named cryptography.hazmat.backends" when I try to start web2py.exe and cannot import pymysql driver. This only happens with pymysql 0.9.2 not 0.8.1 or lower. pymysql 0.9.2 works ok on windows alone not with web2py. I know that for pymysql 0.9.2 it requires cryptography, I already installed it via pip3. May I ask what I'm missing? Thanks so much.
The Windows binary version of web2py (i.e., web2py.exe) includes its own Python interpreter and does not use the system installed Python or any of its libraries. External libraries must be installed into its /site-packages folder. However, given that you already have Python installed on your system, a simpler option is to use the source version of web2py rather than web2py.exe.

installing virtualenvwrapper causes untested argparse to be installed

I have installed virtualenvwrapper in a 3.5.0b1 virtualenv, called setupenv, to be able to generate new python 3.5 test environments easily.
Looking over the list of installed packages, I did see argparse version 1.3.0 installed. This (latest) version of argparse has not been tested with 3.5.
Is this dangerous?
As far as I know 3.2+ comes with its own argparse. Could this install break other packages relying on argparse? Why is this installed at all?
This is probably not dangerous. If you run:
python3.5 -c "import argparse; print(argparse.__file__)"
, you can see that the arparse.py installed with the interpreter takes precedence over the superfluously installed argparse package.
A bit of digging (or using the pipdeptree package) will show you that stevedore is dependent on argparse. This is just sloppy programming (or disregard of possible bandwidth issues).
In a package's setup.py you can easily test if you are running python < 2.7 or 3.0 <= python < 3.2 and only install argparse for those cases.
I would just de-install argparse from your setupenv virtualenv (pip uninstall argparse -y), virtualenvwrapper is not affected by the removal in my experience.
This is actually a bug in stevedore, it uses the pbr package and that supports specification of the python version using environment markers
but stevedore is not using that. The irony is that the example for this in pbr is with argparse, by specifying in the requirements.txt:
argparse; python=='2.6'
A bug report against stevedore was filed, but although the fix was trivial, it was not implemented for several releases. Finally the issue was
set to won't fix, probably because dropped support for 2.6 removed the
need for argparse altogether.