How to install lxml in Macbook Pro M1 Chip device? - odoo

I have been trying to install odoo framework in my laptop. But due to incompatinilty not able to install lxml
File "/Users/ /Odoo/odoo-bin", line 5, in <module>
import odoo
File "/Users/ /Odoo/odoo/__init__.py", line 113, in <module>
from . import modules
File "/Users/ /Odoo/odoo/modules/__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "/Users/ /Odoo/odoo/modules/graph.py", line 10, in <module>
import odoo.tools as tools
File "/Users/ /Odoo/odoo/tools/__init__.py", line 4, in <module>
from . import _monkeypatches
File "/Users/ /Odoo/odoo/tools/_monkeypatches.py", line 6, in <module>
from lxml import etree
ImportError: dlopen(/opt/homebrew/lib/python3.9/site-packages/lxml/etree.cpython-39-darwin.so, 0x0002): tried: '/opt/homebrew/lib/python3.9/site-packages/lxml/etree.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))```

What method do you follow to install odoo? I think it is something that has to do with your python version as well.
However, you can build lxml from its source: https://github.com/lxml/lxml checkout to the following branch lxml-4.9.1 then
python3 setup.py bdist_wheel
cd dist/
sudo pip3 install lxml-4.9.1-cp310-cp310-macosx_12_0_arm64.whl

Related

AttributeError: 'module' object has no attribute 'ceil'

I have installed the module onnx_tf from this link.
After that when I am verifying the installation as python -c "import onnx_tf" I am encountering the following error. How do I resolve it? Thank you
testuser#testuser:~$ python -c "import onnx_tf"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/__init__.py", line 1, in <module>
from . import frontend
File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/frontend.py", line 18, in <module>
from onnx_tf.common.handler_helper import get_all_frontend_handlers
File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/common/handler_helper.py", line 5, in <module>
from onnx_tf.handlers.backend import * # noqa
File "/home/testuser/.local/lib/python2.7/site-packages/onnx_tf/handlers/backend/ceil.py", line 10, in <module>
#tf_func(tf.ceil)
AttributeError: 'module' object has no attribute 'ceil'
Check your tensorflow version
pip show tensorflow
If it's 2.x, you may need to change to older version.
pip install tensorflow-gpu==1.14
or if you are using a cpu...
pip install tensorflow==1.14
The following resolved this issue for me:
pip uninstall onnx-tf
pip install git+https://github.com/onnx/onnx-tensorflow.git
pip install tensorflow-addons
(Using TensorFlow 2.3 and Python 3.8)

Tensorflow Image Retraining Tutorial Bazel Error

I am following the Tensorflow image retraining tutorial located here.
When I try to run this command using bazel:
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos
I get the following error:
Traceback (most recent call last):
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/examples/image_retraining/retrain.py", line 108, in <module>
import tensorflow as tf
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 63, in <module>
from tensorflow.python.framework.framework_lib import *
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/framework_lib.py", line 76, in <module>
from tensorflow.python.framework.ops import Graph
File "/home/j/tensorflow/bazel-bin/tensorflow/examples/image_retraining/retrain.runfiles/org_tensorflow/tensorflow/python/framework/ops.py", line 28, in <module>
from autograd import core as ag_core
ModuleNotFoundError: No module named 'autograd'
However, when I run it using the python command
python tensorflow/examples/image_retraining/retrain.py --image_dir ~/flower_photos
It runs correctly and does not generate this error.
I am running both of the above commands from the ~/tensorflow directory (the top of the git repo)
Environment:
Ubuntu 17.04
Python 3.6.1
Anaconda 4.4.0
Bazel 0.5.4
Tensorflow 1.3 (no GPU) (v1.3.0-rc2-20-g0787eee 1.3.0)
I solved this issue. The autograd dependency was not installed. This can be solved by running pip install autograd
You have to configure TensorFlow before compiling, so it set up all the dependencies: ./configure

ImportError: cannot import name 'HTMLAwareEntitySubstitution'

I just setup beautifulsoup4-4.1.0 and upgrade pip to version 9.0.1.
When I write this :
from bs4 import BeautifulSoup
error occurs:
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
from bs4 import BeautifulSoup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\__init__.py", line 35, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "D:\Program Files (x86)\Python35-32\lib\site-packages\bs4\builder\__init__.py", line 7, in <module>
from bs4.element import (
ImportError: cannot import name 'HTMLAwareEntitySubstitution'
what should I do?Many thanks.
In the version you have it appears that there might be an error in bs4/builder/__init__.py.
This line, from .. import _htmlparser should be: from . import _htmlparser
However, I would suggest re-installing the package using current version of pip before you go off the beaten path and try editing the source code.
To re-install: pip install --upgrade --force-reinstall beautifulsoup4

Install odoo8.0 on Mac OSX 10.11,I got error "unsafe use of relative rpath libpq.5.dylib"

I have downloaded Odoo 8.0 from git ,all my steps:
python --version
Python 2.7.10
Installed PostgresApp into Applications and executed
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
Installed pip
sudo easy_install pip
Finished processing dependencies for pip
and installed homebrew and Xcode-select
Installed other libs
brew install autoconf automake libtool
brew install libxml2 libxslt libevent
Installed Python dependencies
`sudo easy_install -U setuptools
Finished processing dependencies for setuptools
cd odoo/
sudo pip install --user -r requirements.txt
Successfully installed Mako-1.0.1 Pillow-2.7.0 Werkzeug-0.9.6 `
Running odoo
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
./odoo.py --addons-path=addons --db-filter=mydb
And i got this error:
Traceback (most recent call last):
File "./odoo.py", line 160, in <module>
main()
File "./odoo.py", line 156, in main
import openerp
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/__init__.py", line 76, in <module>
import modules
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/modules/__init__.py", line 27, in <module>
from . import db, graph, loading, migration, module, registry
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/modules/graph.py", line 32, in <module>
import openerp.osv as osv
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/osv/__init__.py", line 22, in <module>
import osv
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/osv/osv.py", line 23, in <module>
from .orm import Model, TransientModel, AbstractModel
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/osv/orm.py", line 5, in <module>
from ..models import (
File "/Users/Charlie/Desktop/Python_Workspace/odoo-8.0/openerp/models.py", line 56, in <module>
import psycopg2
File "/Library/Python/2.7/site-packages/psycopg2-2.6.2-py2.7-macosx-10.11-intel.egg/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2-2.6.2-py2.7-macosx-10.11-intel.egg/psycopg2/_psycopg.so, 2): Library not loaded: libpq.5.dylib
Referenced from: /Library/Python/2.7/site-packages/psycopg2-2.6.2-py2.7-macosx-10.11-intel.egg/psycopg2/_psycopg.so
Reason: unsafe use of relative rpath libpq.5.dylib in /Library/Python/2.7/site-packages/psycopg2-2.6.2-py2.7-macosx-10.11-intel.egg/psycopg2/_psycopg.so with restricted binary
I have worked on this about two days.Thanks a lot.

Numpy Install Mac Osx Python

I am using Python for my Linear Algebra course for programming. For the tools we need, I am trying to install NumPy. I used this website to guide me through the installation process.
I started from the links on SciPy's OS X page and eventually arrived at the SourceForge download site.
From there, I chose the Mac OS X installer numpy-1.6.1-py2.7-python.org-macosx10.3.dmg.
When I went to Idle and typed in
>>> import numpy as np
This is the error I received:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
I also tried it from the terminal and got the same error. I have a virtual environment installed - virtual env wrapper. I called the environment in the terminal by:
source my_new_env/bin/activate
And then I tried to import numpy in the terminal that way, but then I got the error:
(my_new_env) $ sudo python -c 'import numpy; numpy.test()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named numpy
I am not sure if I installed NumPy incorrectly or if my virtual environment is conflicting with Nose. If anyone has suggestions let me know!
i would skip the MacOS package install and use the 'pip install' instructions, since you're already familiar with virtualenvs. use these instructions instead: http://www.scipy.org/install.html#installing-via-pip
it's easier to work with a virtualenv and pip, which will ensure post-install that your virtualenv will have access to the modules you've installed. it takes more work to do that with an external package (or .dmg) that you've downloaded. not impossible, just more work. HTH.
Try these commands:
brew update, brew doctor
, because, in my case, I didn't even have to install numpy separately. Yet I could import numpy easily. Meanwhile you can try downloading the numpy package from this website.