Data Analysis with Python Projects - Sea Level Predictor

Problems to run the code
I have problems to run the code. When I clicked run for the first time (code completed) I had an error from Poetry indicating that Pandas was missing (when I could see it in the packages)
I removed it and try to install it but it was failing.
Finally I see Pandas is back in (maybe installed by Poetry? as every time I tried from Packager it failed)
Since then, when I try to run it, I have this error now from the 2nd line of
“ python
Traceback (most recent call last):
File “”, line 2, in
import sea_level_predictor
File “/home/runner/Ex5-sea-level-predictor/”, line 1, in
import pandas as pd
File “/home/runner/Ex5-sea-level-predictor/venv/lib/python3.8/site-packages/pandas/”, line 22, in
from pandas.compat import is_numpy_dev as _is_numpy_dev
File “/home/runner/Ex5-sea-level-predictor/venv/lib/python3.8/site-packages/pandas/compat/”, line 14, in
from pandas._typing import F
File “/home/runner/Ex5-sea-level-predictor/venv/lib/python3.8/site-packages/pandas/”, line 120, in
AttributeError: module ‘numpy.random’ has no attribute ‘BitGenerator’
exit status 1”

I am a bit bewildered by this as theoretically in numpy giving problems when trying to “import pandas as pd”?

Maybe it is a simple thing but I don’t see it.

Here is my code (I have not been able to test it on the platform yet (only on Python from Visual Studio)

Thank you in advance,

Kind regards

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Data Analysis with Python Projects - Sea Level Predictor

Link to the challenge:

Nothing posted. Post a link to the malfunctioning as that is the only way this kind of problem can be diagnosed.

My guess is the solution is the same or similar to here. I would start with uninstalling all dependencies and then reinstalling the necessary ones (probably just pandas) with the packager tool. If it’s slow, give it time to work (it is slow) or refresh the repl and try again.


I am sorry, I am sure I had copied and pasted the link:

As you can see the place is empty. This is my 3rd edit of the reply. I copied the link but when I send it it’s been removed from the text. I am trying now using quotes:
Ex5-sea-level-predictor - Python Repl - Replit

I will try removing all packages,… I did only remove the Pandas package but could not reinstall it. I also tried to reinstall Numpy as the final error seemed to be related to it.
In both cases did not allow me to do it. Gave me this error:
“Replit: Package operation failed.^C”

Kind regards

I have removed all the packages.
Tried to run the code, so Poetry would install the dependencies required, and it failed (mainly Numpy) :

Replit: Updating package configuration

→ python3 -m poetry add matplotlib numpy
Using version ^3.5.3 for matplotlib
Using version ^1.23.2 for numpy

Updating dependencies
Resolving dependencies…


The current project’s Python requirement (>=3.7,<4.0) is not compatible with some of the required packages Python requirement:
- numpy requires Python >=3.8, so it will not be satisfied for Python >=3.7,<3.8

Because no versions of numpy match >1.23.2,<2.0.0
and numpy (1.23.2) requires Python >=3.8, numpy is forbidden.
So, because root depends on numpy (^1.23.2), version solving failed.

at venv/lib/python3.8/site-packages/poetry/puzzle/ in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_lat
 python
Traceback (most recent call last):
File “”, line 2, in
import sea_level_predictor
File “/home/runner/Ex5-sea-level-predictor/”, line 1, in
import pandas as pd
File “/home/runner/Ex5-sea-level-predictor/venv/lib/python3.8/site-packages/pandas/”, line 16, in
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: No module named ‘numpy’
dateutil: No module named ‘dateutil’
exit status 1

Finally I could only reinstall Matplotlib
Scipy, Pandas and Numpy gave me the error Replit: Package operation failed.

Like I said, it’s the same problem as the other threads; you don’t have your dependencies installed in and you just need to use the packager tool and poetry to install them.

This time you need matplotlib, pandas, and scipy. Uninstall everything, reinstall, and watch the console errors. numpy will tell you that you need a newer python than 3.7 and once you fix that in pyproject.toml, scipy will tell you that it needs python = ">=3.8,<3.12". Once you update pyproject.toml accordingly, scipy installs and the project runs.

Thank you.

I will try that “pyproject.toml” thing. However, as I told you before I have already removed matplotlib, pandas, and scipy and when trying to reinstall (from packager as you showed me in another thread) I could only install matplotlib as the other two gave me errors.

I have tried changing Python in “pyproject.toml”. Once I changed python version to 3.8, automatically numpy was upgraded or installed.
Then I tried installing pandas and it worked.
I tried to installed scipy and it failed with the same error.

I can see now Poetry is much longer.

Obviously when I try to run it fails as scipy is not there to be imported.

Finally I installed scipy manually from the console (pip install scipy) and added scipy=“^1.9.1” to pyproject.toml and seems to be working.

Kind regards

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.