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
HI,
Same error, I did it adding the sudo to those commands, but it does not work:
user:~$ sudo 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 Release process - pip documentation v22.3.dev0 pip 21.0 will remove support for this functionality.
WARNING: The directory ‘/home/user/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Collecting statsmodels
Downloading statsmodels-0.11.0.tar.gz (15.4 MB)
|################################| 15.4 MB 19.8 MB/s
Installing build dependencies … done
Getting requirements to build wheel … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpdzizhA
cwd: /tmp/pip-install-HfE7Oe/statsmodels
Complete output (21 lines):
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py”, line 280, in
main()
File “/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py”, line 263, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “/usr/local/lib/python2.7/dist-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
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 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpdzizhA Check the logs for full command output.
Apparently, the scipy package is not the version needed. I don’t know if it is related with the Python version?
Please help.
Hi,
I Installed statsmodels version 0.8.0, it installed, but the scripts are not running. This is the warning but it does not shows anything:
/usr/local/lib/python2.7/dist-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetoolsmodule is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
Please help???
HI
Sorry the amount of comments… It is solved… At the end of the script in section 2.3, the sentence “plt.show()” is missing.
Cheers,
Hey @bayodesegun,
Still seems there are some environmental issues going on since python 2.7
has reached end of life.
The current scipy
is throwing the specific error and may need to be manually upgraded on the backend within the virtual enviorment. Do note that I’ve attempted both sudo
and sudo -H
without any progression.
scipy is installed but older (0.19.0) than required (1.0). You must manuallyupgrade scipy before installing or install into a fresh virtualenv.