In Unit 2, 2.3 Multiple linear regression the code provided makes use of the library statsmodels.api. When I run the script it prompts me with the error:
ImportError: No module named statsmodels.api
In Unit 2, 2.3 Multiple linear regression the code provided makes use of the library statsmodels.api. When I run the script it prompts me with the error:
ImportError: No module named statsmodels.api
Sorry about that. Please fix that in the meantime by running:
pip install --upgrade pip
pip install --upgrade scipy
pip install --upgrade statsmodels
If you have trouble running pip
add sudo
before the pip commands.
I have run those commands, but when upgrading statsmodels it gives me the following:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting statsmodels
Using cached statsmodels-0.11.0.tar.gz (15.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpeEDBvq
cwd: /tmp/pip-install-fyiyxo/statsmodels
Complete output (21 lines):
Traceback (most recent call last):
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 127, in _get_build_requires
self.run_setup()
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 56, in <module>
raise RuntimeError(REQ_NOT_MET_MSG.format(key, ver, req_ver))
RuntimeError:
scipy is installed but older (0.19.0) than required (1.0). You must manually
upgrade scipy before installing or install into a fresh virtualenv.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpeEDBvq Check the logs for full command output.
I have also done a sudo apt update
and sudo apt upgrade -y
but that did not change a thing.
Hi! Even I seem to have the same issue, when importing the statsmodels.api module.
I tried running the below commands
but stumbled into an error when running the last command of pip install --upgrade statsmodels
user:~/catkin_ws/src/machine_learning_course$ pip install --upgrade statsmodels
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting statsmodels
Using cached statsmodels-0.11.0.tar.gz (15.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_oUkLD
cwd: /tmp/pip-install-rOOREY/statsmodels
Complete output (21 lines):
Traceback (most recent call last):
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 127, in _get_build_requires
self.run_setup()
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 243, in run_setup
self).run_setup(setup_script=setup_script)
File "/usr/local/lib/python2.7/dist-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 56, in <module>
raise RuntimeError(REQ_NOT_MET_MSG.format(key, ver, req_ver))
RuntimeError:
scipy is installed but older (0.19.0) than required (1.0). You must manually
upgrade scipy before installing or install into a fresh virtualenv.
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python /home/user/.local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp_oUkLD Check the logs for full command output.
I believe there is an error in my scipy package. I am not able to manually update it.
Could you please help me in this?
Thank you,
Regards,
Riddhi
@GasPatxo @ridhgoswami
Please add sudo
to the pip commands:
sudo pip install --upgrade pip
sudo pip install --upgrade scipy
sudo pip install --upgrade statsmodels