How to install MLPY

i am getting errors while i install mlpy by following command

pip install mlpy

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-1ubnipxp/mlpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-8wzw_9pf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-1ubnipxp/mlpy/

Have you tried it as

pip install machine-learning-py

YES !!!
again the same error

Command “/usr/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-install-x1jow1_q/machine-learning-py/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-record-u573hhsn/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-install-x1jow1_q/machine-learning-py/

please help me to solve this issue

Hi @Bharath_Varma,
I’m not sure about what is causing the problem,
Can you try this one

Collecting mlpy
  Using cached https://files.pythonhosted.org/packages/93/3c/be8ccff2aa3e5ce3b922cff026aadc62d3a671168e42616b1e0b8eccba12/mlpy-0.1.0.tar.gz
Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from mlpy) (3.2.1)
Requirement already satisfied: numpy>=1.6.2 in /usr/lib/python3/dist-packages (from mlpy) (1.16.2)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from mlpy) (0.22.2.post1)
Requirement already satisfied: scipy>=0.11 in /usr/local/lib/python3.7/dist-packages (from mlpy) (1.4.1)
Requirement already satisfied: six>=1.9.0 in /usr/lib/python3/dist-packages (from mlpy) (1.12.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mlpy) (1.2.0)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3/dist-packages (from matplotlib->mlpy) (2.7.3)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mlpy) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mlpy) (2.4.7)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->mlpy) (0.14.1)
Building wheels for collected packages: mlpy
  Building wheel for mlpy failed: [Errno 13] Permission denied: '/home/mask/.cache/pip/wheels/c4'
Failed to build mlpy
Installing collected packages: mlpy
  Running setup.py install for mlpy ... e[?25lerror
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-lavxawax/mlpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ydk021qw/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/mlpy
    copying mlpy/__init__.py -> build/lib.linux-x86_64-3.7/mlpy
    running egg_info
    writing mlpy.egg-info/PKG-INFO
    writing dependency_links to mlpy.egg-info/dependency_links.txt
    writing requirements to mlpy.egg-info/requires.txt
    writing top-level names to mlpy.egg-info/top_level.txt
    reading manifest file 'mlpy.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*.sdf' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*.sln' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*.suo' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*.exp' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*.ilk' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*.lib' found under directory 'mlpy/libs'
    warning: no previously-included files matching '*pdb' found under directory 'mlpy/libs'
    warning: no previously-included files matching '__pycache__' found under directory '*'
    no previously-included directories found matching 'mlpy/libs/classifier/classifier'
    no previously-included directories found matching 'mlpy/libs/hmmc/hmmc'
    no previously-included directories found matching 'docs/build'
    no previously-included directories found matching 'docs/generated'
    writing manifest file 'mlpy.egg-info/SOURCES.txt'
    creating build/lib.linux-x86_64-3.7/mlpy/agents
    copying mlpy/agents/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/agents
    copying mlpy/agents/fsm.py -> build/lib.linux-x86_64-3.7/mlpy/agents
    copying mlpy/agents/modules.py -> build/lib.linux-x86_64-3.7/mlpy/agents
    copying mlpy/agents/world.py -> build/lib.linux-x86_64-3.7/mlpy/agents
    creating build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/array.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/datasets.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/datastructs.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/io.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/misc.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    copying mlpy/auxiliary/plotting.py -> build/lib.linux-x86_64-3.7/mlpy/auxiliary
    creating build/lib.linux-x86_64-3.7/mlpy/cluster
    copying mlpy/cluster/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/cluster
    copying mlpy/cluster/vq.py -> build/lib.linux-x86_64-3.7/mlpy/cluster
    creating build/lib.linux-x86_64-3.7/mlpy/constants
    copying mlpy/constants/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/constants
    copying mlpy/constants/_constants.py -> build/lib.linux-x86_64-3.7/mlpy/constants
    creating build/lib.linux-x86_64-3.7/mlpy/environments
    copying mlpy/environments/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/environments
    copying mlpy/environments/gridworld.py -> build/lib.linux-x86_64-3.7/mlpy/environments
    copying mlpy/environments/nao.py -> build/lib.linux-x86_64-3.7/mlpy/environments
    creating build/lib.linux-x86_64-3.7/mlpy/environments/webots
    creating build/lib.linux-x86_64-3.7/mlpy/environments/webots/controllers
    creating build/lib.linux-x86_64-3.7/mlpy/environments/webots/controllers/serverc
    copying mlpy/environments/webots/controllers/serverc/serverc.py -> build/lib.linux-x86_64-3.7/mlpy/environments/webots/controllers/serverc
    creating build/lib.linux-x86_64-3.7/mlpy/experiments
    copying mlpy/experiments/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/experiments
    copying mlpy/experiments/task.py -> build/lib.linux-x86_64-3.7/mlpy/experiments
    creating build/lib.linux-x86_64-3.7/mlpy/knowledgerep
    copying mlpy/knowledgerep/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep
    creating build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    copying mlpy/knowledgerep/cbr/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    copying mlpy/knowledgerep/cbr/engine.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    copying mlpy/knowledgerep/cbr/features.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    copying mlpy/knowledgerep/cbr/methods.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    copying mlpy/knowledgerep/cbr/similarity.py -> build/lib.linux-x86_64-3.7/mlpy/knowledgerep/cbr
    creating build/lib.linux-x86_64-3.7/mlpy/learners
    copying mlpy/learners/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/learners
    creating build/lib.linux-x86_64-3.7/mlpy/learners/offline
    copying mlpy/learners/offline/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/learners/offline
    copying mlpy/learners/offline/irl.py -> build/lib.linux-x86_64-3.7/mlpy/learners/offline
    creating build/lib.linux-x86_64-3.7/mlpy/learners/online
    copying mlpy/learners/online/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/learners/online
    copying mlpy/learners/online/rl.py -> build/lib.linux-x86_64-3.7/mlpy/learners/online
    creating build/lib.linux-x86_64-3.7/mlpy/libs
    copying mlpy/libs/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/libs
    copying mlpy/libs/classifier.pyd -> build/lib.linux-x86_64-3.7/mlpy/libs
    copying mlpy/libs/hmmc.pyd -> build/lib.linux-x86_64-3.7/mlpy/libs
    copying mlpy/libs/noconflict.py -> build/lib.linux-x86_64-3.7/mlpy/libs
    creating build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/array_helper.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/array_helper.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/c45tree.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/c45tree.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/classifier.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/classifier.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/classifier_module.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/classifier_module.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/coord.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/coord.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/random.cc -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    copying mlpy/libs/classifier/random.h -> build/lib.linux-x86_64-3.7/mlpy/libs/classifier
    creating build/lib.linux-x86_64-3.7/mlpy/libs/hmmc
    copying mlpy/libs/hmmc/hmm.c -> build/lib.linux-x86_64-3.7/mlpy/libs/hmmc
    copying mlpy/libs/hmmc/hmm.h -> build/lib.linux-x86_64-3.7/mlpy/libs/hmmc
    copying mlpy/libs/hmmc/hmmc_module.c -> build/lib.linux-x86_64-3.7/mlpy/libs/hmmc
    copying mlpy/libs/hmmc/hmmc_module.h -> build/lib.linux-x86_64-3.7/mlpy/libs/hmmc
    creating build/lib.linux-x86_64-3.7/mlpy/mdp
    copying mlpy/mdp/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/mdp
    copying mlpy/mdp/discrete.py -> build/lib.linux-x86_64-3.7/mlpy/mdp
    copying mlpy/mdp/distrib.py -> build/lib.linux-x86_64-3.7/mlpy/mdp
    copying mlpy/mdp/stateaction.py -> build/lib.linux-x86_64-3.7/mlpy/mdp
    creating build/lib.linux-x86_64-3.7/mlpy/mdp/continuous
    copying mlpy/mdp/continuous/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/mdp/continuous
    copying mlpy/mdp/continuous/casml.py -> build/lib.linux-x86_64-3.7/mlpy/mdp/continuous
    creating build/lib.linux-x86_64-3.7/mlpy/modules
    copying mlpy/modules/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/modules
    copying mlpy/modules/patterns.py -> build/lib.linux-x86_64-3.7/mlpy/modules
    creating build/lib.linux-x86_64-3.7/mlpy/optimize
    copying mlpy/optimize/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/optimize
    copying mlpy/optimize/algorithms.py -> build/lib.linux-x86_64-3.7/mlpy/optimize
    copying mlpy/optimize/utils.py -> build/lib.linux-x86_64-3.7/mlpy/optimize
    creating build/lib.linux-x86_64-3.7/mlpy/planners
    copying mlpy/planners/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/planners
    copying mlpy/planners/discrete.py -> build/lib.linux-x86_64-3.7/mlpy/planners
    creating build/lib.linux-x86_64-3.7/mlpy/planners/explorers
    copying mlpy/planners/explorers/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/planners/explorers
    copying mlpy/planners/explorers/discrete.py -> build/lib.linux-x86_64-3.7/mlpy/planners/explorers
    creating build/lib.linux-x86_64-3.7/mlpy/search
    copying mlpy/search/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/search
    copying mlpy/search/informed.py -> build/lib.linux-x86_64-3.7/mlpy/search
    creating build/lib.linux-x86_64-3.7/mlpy/stats
    copying mlpy/stats/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/stats
    copying mlpy/stats/_conditional.py -> build/lib.linux-x86_64-3.7/mlpy/stats
    copying mlpy/stats/_discrete.py -> build/lib.linux-x86_64-3.7/mlpy/stats
    copying mlpy/stats/_multivariate.py -> build/lib.linux-x86_64-3.7/mlpy/stats
    copying mlpy/stats/_stats.py -> build/lib.linux-x86_64-3.7/mlpy/stats
    creating build/lib.linux-x86_64-3.7/mlpy/stats/dbn
    copying mlpy/stats/dbn/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/stats/dbn
    copying mlpy/stats/dbn/hmm.py -> build/lib.linux-x86_64-3.7/mlpy/stats/dbn
    creating build/lib.linux-x86_64-3.7/mlpy/stats/models
    copying mlpy/stats/models/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/stats/models
    copying mlpy/stats/models/_basic.py -> build/lib.linux-x86_64-3.7/mlpy/stats/models
    copying mlpy/stats/models/mixture.py -> build/lib.linux-x86_64-3.7/mlpy/stats/models
    creating build/lib.linux-x86_64-3.7/mlpy/tools
    copying mlpy/tools/__init__.py -> build/lib.linux-x86_64-3.7/mlpy/tools
    copying mlpy/tools/configuration.py -> build/lib.linux-x86_64-3.7/mlpy/tools
    copying mlpy/tools/log.py -> build/lib.linux-x86_64-3.7/mlpy/tools
    copying mlpy/tools/misc.py -> build/lib.linux-x86_64-3.7/mlpy/tools
    running build_ext
    building 'classifier' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/mlpy
    creating build/temp.linux-x86_64-3.7/mlpy/libs
    creating build/temp.linux-x86_64-3.7/mlpy/libs/classifier
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/lib/python3/dist-packages/numpy/core/include -I/usr/include/python3.7m -c mlpy/libs/classifier/classifier_module.cc -o build/temp.linux-x86_64-3.7/mlpy/libs/classifier/classifier_module.o
    mlpy/libs/classifier/classifier_module.cc: In function ‘PyObject* initclassifier()’:
    mlpy/libs/classifier/classifier_module.cc:33:7: error: ‘Py_InitModule3’ was not declared in this scope
       33 |   m = Py_InitModule3("classifier", ClassifierMethods, "Classification module");
          |       ^~~~~~~~~~~~~~
    mlpy/libs/classifier/classifier_module.cc:34:18: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       34 |   if (m == NULL) return;
          |                  ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:37:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       37 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:42:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       42 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:48:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       48 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:53:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       53 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:58:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       58 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:63:4: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
       63 |    return;
          |    ^~~~~~
    mlpy/libs/classifier/classifier_module.cc:68:2: warning: control reaches end of non-void function [-Wreturn-type]
       68 |  }
          |  ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-lavxawax/mlpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ydk021qw/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-lavxawax/mlpy/
e[?25h

I’m not sure, maybe you can raise a concern on mlpy support forum or something like that.

Most of the time these are dependency-issues. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. When encountering this error please note before the error it may say you are missing a package or header file — you should find those and install them and verify if it works

For Python 2.x use:

$ sudo apt-get install python-dev

If you using python 3, try to replace python-dev with python3-dev

For a specific version of Python 3, replace x with the minor version in

$ sudo apt-get install python3.x-dev

1 Like