I'm trying to install and run AIMA's code on my m1 Mac running macOS 12.5.
Before installing AIMA's code, I installed homeBrew and TensorFlow following these steps using a Virtual environment with python 3.8. I named this environment AIMA_ENV. No errors were shown this far.
Once I had successfully installed tensroflow & ran the benchmark using a jupyter notebook, I began to follow AIMA's installation instructions. Everything was running smooth until I ran the command
pip install -r requirements.txt
this returned the first two errors:
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
Note that I was running all these commands on the terminal where I had my virtual environment enabled and where I had already successfully installed & tested TensorFlow.
I decided to ignore these errors and continue with the installation guide. All continued to run smooth until I ran the test py.test
Errors found:
================================================================================================== ERRORS ==================================================================================================
__________________________________________________________________________________ ERROR collecting tests/test_agents.py ___________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_agents.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_agents.py:5: in <module>
from agents import (ReflexVacuumAgent, ModelBasedVacuumAgent, TrivialVacuumEnvironment, compare_agents,
agents.py:34: in <module>
from ipythonblocks import BlockGrid
E ModuleNotFoundError: No module named 'ipythonblocks'
_________________________________________________________________________________ ERROR collecting tests/test_agents4e.py __________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_agents4e.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_agents4e.py:5: in <module>
from agents4e import (ReflexVacuumAgent, ModelBasedVacuumAgent, TrivialVacuumEnvironment, compare_agents,
agents4e.py:39: in <module>
from ipythonblocks import BlockGrid
E ModuleNotFoundError: No module named 'ipythonblocks'
____________________________________________________________________________________ ERROR collecting tests/test_csp.py ____________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_csp.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_csp.py:3: in <module>
from csp import *
csp.py:11: in <module>
from sortedcontainers import SortedSet
E ModuleNotFoundError: No module named 'sortedcontainers'
______________________________________________________________________________ ERROR collecting tests/test_deep_learning4e.py ______________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_deep_learning4e.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_deep_learning4e.py:5: in <module>
from learning4e import DataSet, grade_learner, err_ratio
learning4e.py:7: in <module>
from qpsolvers import solve_qp
E ModuleNotFoundError: No module named 'qpsolvers'
_________________________________________________________________________________ ERROR collecting tests/test_knowledge.py _________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_knowledge.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_knowledge.py:3: in <module>
from knowledge import *
knowledge.py:10: in <module>
from logic import (FolKB, constant_symbols, predicate_symbols, standardize_variables,
logic.py:40: in <module>
import networkx as nx
E ModuleNotFoundError: No module named 'networkx'
_________________________________________________________________________________ ERROR collecting tests/test_learning.py __________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_learning.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_learning.py:3: in <module>
from learning import *
learning.py:7: in <module>
from qpsolvers import solve_qp
E ModuleNotFoundError: No module named 'qpsolvers'
________________________________________________________________________________ ERROR collecting tests/test_learning4e.py _________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_learning4e.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_learning4e.py:4: in <module>
from learning4e import *
learning4e.py:7: in <module>
from qpsolvers import solve_qp
E ModuleNotFoundError: No module named 'qpsolvers'
___________________________________________________________________________________ ERROR collecting tests/test_logic.py ___________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_logic.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_logic.py:3: in <module>
from logic import *
logic.py:40: in <module>
import networkx as nx
E ModuleNotFoundError: No module named 'networkx'
__________________________________________________________________________________ ERROR collecting tests/test_logic4e.py __________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_logic4e.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_logic4e.py:3: in <module>
from logic4e import *
logic4e.py:37: in <module>
from agents import Agent, Glitter, Bump, Stench, Breeze, Scream
agents.py:34: in <module>
from ipythonblocks import BlockGrid
E ModuleNotFoundError: No module named 'ipythonblocks'
_______________________________________________________________________________ ERROR collecting tests/test_perception4e.py ________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_perception4e.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_perception4e.py:5: in <module>
from perception4e import *
perception4e.py:3: in <module>
import cv2
E ModuleNotFoundError: No module named 'cv2'
_________________________________________________________________________________ ERROR collecting tests/test_planning.py __________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_planning.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_planning.py:5: in <module>
from planning import *
planning.py:11: in <module>
from csp import sat_up, NaryCSP, Constraint, ac_search_solver, is_constraint
csp.py:11: in <module>
from sortedcontainers import SortedSet
E ModuleNotFoundError: No module named 'sortedcontainers'
__________________________________________________________________________ ERROR collecting tests/test_probabilistic_learning.py ___________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_probabilistic_learning.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_probabilistic_learning.py:5: in <module>
from learning import DataSet
learning.py:7: in <module>
from qpsolvers import solve_qp
E ModuleNotFoundError: No module named 'qpsolvers'
________________________________________________________________________________ ERROR collecting tests/test_probability.py ________________________________________________________________________________
ImportError while importing test module '/Users/cosmic/Desktop/aima-python/tests/test_probability.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../mambaforge/envs/AIMA_ENV/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_probability.py:3: in <module>
from probability import *
probability.py:6: in <module>
from agents import Agent
agents.py:34: in <module>
from ipythonblocks import BlockGrid
E ModuleNotFoundError: No module named 'ipythonblocks'
========================================================================================= short test summary info ==========================================================================================
ERROR tests/test_agents.py
ERROR tests/test_agents4e.py
ERROR tests/test_csp.py
ERROR tests/test_deep_learning4e.py
ERROR tests/test_knowledge.py
ERROR tests/test_learning.py
ERROR tests/test_learning4e.py
ERROR tests/test_logic.py
ERROR tests/test_logic4e.py
ERROR tests/test_perception4e.py
ERROR tests/test_planning.py
ERROR tests/test_probabilistic_learning.py
ERROR tests/test_probability.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 13 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================ 13 errors in 2.81s ============================================================================================
(AIMA_ENV) cosmic@Cosmics-MacBook-Air aima-python %
I don't know how to resolve these errors. Is there something else I could try?
After updating my requirements.txt file to
cvxopt
image
ipython
ipythonblocks
ipywidgets
jupyter
keras
matplotlib
networkx
numpy
opencv-python
pandas
pillow
pytest-cov
qpsolvers
scipy
sortedcontainers
and rerunning the pip install -r requirements.txt
I am now getting these new errors
CodePudding user response:
After doing all the things I said on my post, I kept on getting the new error regarding cvxopt. To solve this I ran the command:
$ conda install -c conda-forge cvxopt
then I just continued with the AIMA installation guide.
All tests from py.test are now passed except one regarding keras.
this issue is not critical for me because we won't be using that.
CodePudding user response:
Note that this works with Python 3.10
The main tensorflow
package doesn't support arm64
Macs, you need to install the alternative package tensorflow-macos
, so update your requirements.txt
from the AIMA repo to look like this, since you already have tensorflow
installed from brew.
cvxopt
image
ipython
ipythonblocks
ipywidgets
jupyter
keras
matplotlib
networkx
numpy
opencv-python
pandas
pillow
pytest-cov
qpsolvers
scipy
sortedcontainers
Then rerun the requirements installation and hopefully it all installs.
For your cvxopt
issue
You are using Python 3.8, and cvxopt
only provides pre-built wheels for ARM64 Macs for Python 3.9 and Python 3.10.
If you don't want to switch to Python 3.9 (the system default from MacOS 12.x) or Python 3.10, you can use Conda to install it as you have, otherwise the manual way would be:
brew install gsl fftw suite-sparse glpk
export CVXOPT_BUILD_FFTW=1
export CVXOPT_BUILD_GLPK=1
export CVXOPT_BUILD_GSL=1
CFLAGS="-I $(brew --prefix)/include" LD_FLAGS="-L $(brew --prefix)/lib" pip install cvxopt