Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator

Don’t know how to fix it

Hello, I’m currently doing the Data Analysis with Python course and struggling with the first project. I don’t understand how to fix the issue showed in the console, I think it’s because of some problem with replit and numpy but I’m not sure.

Here is the console message once I run the program.

--> poetry lock --no-update
Resolving dependencies...
--> poetry install
Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing numpy (1.18.5)

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  Running from numpy source directory.
  /tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    required_version = LooseVersion('0.29.14')
  /tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py:77: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(cython_version) < required_version:
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          for i in range(1, RK_STATE_LEN):
              self.rng_state.key[i] = val[i]
          self.rng_state.pos = i
  
          self._bitgen.state = &self.rng_state
          self._bitgen.next_uint64 = &mt19937_uint64
                                     ^
  ------------------------------------------------------------
  
  _mt19937.pyx:138:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
  Processing numpy/random/_bounded_integers.pxd.in
  Processing numpy/random/_mt19937.pyx
  Traceback (most recent call last):
    File "/tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py", line 238, in <module>
      main()
    File "/tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py", line 234, in main
      find_process_files(root_dir)
    File "/tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py", line 225, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "/tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py", line 191, in process
      processor_function(fromfile, tofile)
    File "/tmp/tmp04x1x991/numpy-1.18.5/tools/cythonize.py", line 80, in process_pyx
      subprocess.check_call(
    File "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/tmp/tmpwz4g9lqc/.venv/bin/python', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
  Cythonizing sources
  Traceback (most recent call last):
    File "/nix/store/fcbymdrl3n3ksr6z2zbsmsb2vnixyz39-poetry-in-venv/env/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/nix/store/fcbymdrl3n3ksr6z2zbsmsb2vnixyz39-poetry-in-venv/env/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/nix/store/fcbymdrl3n3ksr6z2zbsmsb2vnixyz39-poetry-in-venv/env/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/build_meta.py", line 413, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
      self.run_setup()
    File "/nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/build_meta.py", line 484, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/nix/store/icx0zbk2r2qrpnqpd41q4h4xzr856d4f-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/setuptools/build_meta.py", line 335, in run_setup
      exec(code, locals())
    File "<string>", line 488, in <module>
    File "<string>", line 469, in setup_package
    File "<string>", line 275, in generate_cython
  RuntimeError: Running cythonize failed!
  

  at /nix/store/fcbymdrl3n3ksr6z2zbsmsb2vnixyz39-poetry-in-venv/env/lib/python3.10/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with numpy (1.18.5) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "numpy (==1.18.5)"'.

exit status 1

This is my code so far

import numpy as np

def calculate(list):
  try:
    listInAxes = np.array(list).reshape(3,3)
    calculations = { 'mean': [[listInAxes[:,0].mean(),listInAxes[:,1].mean(),listInAxes[:,2].mean()], [listInAxes[0,:].mean(),listInAxes[1,:].mean(),listInAxes[2,:].mean()],listInAxes.mean()], 'variance': [[listInAxes[:,0].var(),listInAxes[:,1].var(),listInAxes[:,2].var()],[listInAxes[0,:].var(),listInAxes[1,:].var(),listInAxes[2,:].var()],listInAxes.var()], 'standard deviation': [[listInAxes[:,0].std(),listInAxes[:,1].std(),listInAxes[:,2].std()],[listInAxes[0,:].std(),listInAxes[1,:].std(),listInAxes[2,:].std()],listInAxes.std()], 'max': [[listInAxes[:,0].max(),listInAxes[:,1].max(),listInAxes[:,2].max()],[listInAxes[0,:].max(),listInAxes[1,:].max(),listInAxes[2,:].max()],listInAxes.max()], 'min': [[listInAxes[:,0].min(),listInAxes[:,1].min(),listInAxes[:,2].min()],[listInAxes[0,:].min(),listInAxes[1,:].min(),listInAxes[2,:].min()],listInAxes.min()], 'sum': [[listInAxes[:,0].sum(),listInAxes[:,1].sum(),listInAxes[:,2].sum()],[listInAxes[0,:].sum(),listInAxes[1,:].sum(),listInAxes[2,:].sum()],listInAxes.sum()] }
  except ValueError:
    raise ValueError("List must contain nine numbers.")
  return calculations

If someone can help me understand, i would appreciate it very much. Sorry for the bad English

Your browser information:

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

Challenge Information:

Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator

Hi, welcome to the forum.

Show the hidden files and then delete
poetry.lock,
pyproject.toml and
replit.nix

Screenshot 2023-10-02 073220

You can see other solutions here:
https://forum.freecodecamp.org/search?q=exit%20status%201%20%23python%20order%3Alatest

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