PacktPublishing / Modern-Time-Series-Forecasting-with-Python

Modern Time Series Forecasting with Python, published by Packt
MIT License
429 stars 217 forks source link

Issues getting environment properly installed on M1 Mac #4

Open davidcolton opened 1 year ago

davidcolton commented 1 year ago

Any help you'd be able to offer to get the development environment setup and working on an M1 Mac would be greatly appreciated.

The log of the conda command is attached.

Thanks.

conda_error.log

manujosephv commented 1 year ago

These dependency errors are notoriously hard to figure out. One way to try and resolve is to unpin versions in the conda file one by one.

for instance: Try changing statsforecast==0.6.0 to statsforecast>=0.6.0 and python-kaleido==0.1.0 to python-kaleido>=0.1.0

And if that's also not working, - u8darts<=0.19.0 to - u8darts==0.19.0 or - u8darts>=0.19.0

While this can resolve the conda dependency issues, there is a small risk that some code may not work.

koen-dejonghe commented 1 year ago

I have followed the instructions for statsforecast and python-kaleido. Seems to work, but then:

Executing transaction: done
Installing pip dependencies: | Ran pip subprocess with arguments:
['/opt/homebrew/anaconda3/envs/modern_ts/bin/python', '-m', 'pip', 'install', '-U', '-r', '/Users/.../Modern-Time-Series-Forecasting-with-Python/condaenv.3kbl5r_a.requirements.txt', '--exists-action=b']
Pip subprocess output:
Collecting git+https://github.com/manujosephv/pytorch_tabular.git@76e83fb (from -r /Users/.../Modern-Time-Series-Forecasting-with-Python/condaenv.3kbl5r_a.requirements.txt (line 8))
  Cloning https://github.com/manujosephv/pytorch_tabular.git (to revision 76e83fb) to /private/var/folders/wy/v6f0ncw16k58dwlsf1jjph7c0000gq/T/pip-req-build-_6pcpbj7
  Resolved https://github.com/manujosephv/pytorch_tabular.git to commit 76e83fb
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

Pip subprocess error:
  Running command git clone --filter=blob:none --quiet https://github.com/manujosephv/pytorch_tabular.git /private/var/folders/wy/v6f0ncw16k58dwlsf1jjph7c0000gq/T/pip-req-build-_6pcpbj7
  WARNING: Did not find branch or tag '76e83fb', assuming revision or ref.
  Running command git checkout -q 76e83fb
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      error in pytorch_tabular setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier)
          protobuf<=3.20.*
                  ~~~~~~^
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

failed

CondaEnvException: Pip failed
koen-dejonghe commented 1 year ago

fancyimpute also does not install:

      subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for osqp
Failed to build osqp
ERROR: Could not build wheels for osqp, which is required to install pyproject.toml-based projects

I dug further into this, by trying to install al sorts of packages with brew (cmake, llvm, suite-sparse), but to no avail.

Richdadua commented 1 year ago

...

WARNING: Did not find branch or tag '76e83fb', assuming revision or ref. Running command git checkout -q 76e83fb error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [3 lines of output] error in pytorch_tabular setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected end or semicolon (after version specifier) protobuf<=3.20.*


      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

failed

CondaEnvException: Pip failed
```
I got exactly the same error
manujosephv commented 1 year ago

@koen-dejonghe I think you can safely skip fancyimpute. It is a problematic package. The other error, let me dig into and figure out.

manujosephv commented 1 year ago

As of 22.0, pip has made some changes which might be causing this issue. I've seen this for other libraries as well. Issue on packaging

So, this is the solution:

I have removed timesynth and fancyimpute from the anaconda env. That along with the changes to statsforecast and python-kaleido make it working in my M1 Pro. (I haven't checked in statsforecast and python-kaleido changes because it seems to be Mac specific. I'll probably add it to the Readme as well. The downside is that there is one notebook in chapter 1 which uses timesynth. You can try installing that separately and see if that works. Good news is that the rest of the environment works fine now.

Let me know if this works for you so that I can pin the issue and add it to readme.

koen-dejonghe commented 1 year ago

With the new anaconda_env.yml , the conda environment installs without issues on my machine. Thank you very much.

fip17 commented 1 year ago

Mac M2/M1 problem on runnin test_installation.py:
AssertionError: Torch not compiled with CUDA enabled

I did the version yml corrections for statsforecast>=0.6.0 and python-kaleido>=0.1.0 and u8darts>=0.19.0 mamba env create -f anaconda_env.yml

no fancyimpute, no timesynth