Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install kats fail #308

Open
xiaogangzhu opened this issue Apr 26, 2023 · 22 comments
Open

pip install kats fail #308

xiaogangzhu opened this issue Apr 26, 2023 · 22 comments

Comments

@xiaogangzhu
Copy link

Got fail always when pip install kats

Building wheels for collected packages: fbprophet, pymeeus, lit
  Building wheel for fbprophet (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
 running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/fbprophet
      creating build/lib/fbprophet/stan_model
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-skwqxzk2/fbprophet_c4f34e779718451891a5ac53db49fa8c/setup.py", line 122, in <module>
          setup(
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-install-skwqxzk2/fbprophet_c4f34e779718451891a5ac53db49fa8c/setup.py", line 48, in run
          build_models(target_dir)
        File "/tmp/pip-install-skwqxzk2/fbprophet_c4f34e779718451891a5ac53db49fa8c/setup.py", line 36, in build_models
          from fbprophet.models import StanBackendEnum
        File "/tmp/pip-install-skwqxzk2/fbprophet_c4f34e779718451891a5ac53db49fa8c/fbprophet/__init__.py", line 8, in <module>
          from fbprophet.forecaster import Prophet
        File "/tmp/pip-install-skwqxzk2/fbprophet_c4f34e779718451891a5ac53db49fa8c/fbprophet/forecaster.py", line 14, in <module>
          import numpy as np
      ModuleNotFoundError: No module named 'numpy'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fbprophet
Running setup.py install for fbprophet ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for fbprophet did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      running install
      /u/xzhu57/.conda/envs/test/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib
      creating build/lib/fbprophet
      creating build/lib/fbprophet/stan_model
      COMPILING THE C++ CODE FOR MODEL anon_model_dfdaf2b8ece8a02eb11f050ec701c0ec NOW.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> fbprophet

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

This is python 3.8.Anyone helps?

@xiaogangzhu
Copy link
Author

I see there is a lot of bug installing kats, can someone help improve the install performance? It will be of great help.

@HariprasadManimozhi
Copy link

I also face same error. Help to resolve.

@JustinCharbonneau
Copy link

Same. I tried creating a virtual environment with conda create -n ts python=3.9 on my windows laptop and then simply pip install kats, but no luck.

@ielasry
Copy link

ielasry commented May 15, 2023

it works for me with :
conda install compilers -c conda-forge
pip install --upgrade --no-deps --force-reinstall fbprophet

@shreyastalamakki
Copy link

I'm having the same issue as well. My forecasting project was working prior to today but now it seems to be throwing the same issue when pip installing kats:

image

@navneetsonak-ds
Copy link

I'm having the same issue. Any resolution for this?

@waqarahmed6095
Copy link

This installation works for me.

Create conda environment in a particular directory

conda create --prefix ./env python=3.7

Install fbprophet

conda install -c conda-forge fbprophet

Install Kats

pip install kats

Downgrade Packaging to 21.3

Change the line 178 in the site-packages\holidays\registry.py file in conda environment
from super().init(*args, **kwargs) to super().init()

@ferdinandyb
Copy link

ferdinandyb commented May 22, 2023

I got the same error as @xiaogangzhu when installing. I used python 3.7 as I noticed the requirements.txt says <python3.8 for two libs, but building fbprophet still dies. I actually managed to get to where it complains that pystan is not installed (although it is).

@waqarahmed6095
Copy link

Don't use requirement.txt, the simplest installation can be made using conda env. I did it today and is working

@PG-9-9
Copy link

PG-9-9 commented May 22, 2023

This installation works for me.

Create conda environment in a particular directory

conda create --prefix ./env python=3.7

Install fbprophet

conda install -c conda-forge fbprophet

Install Kats

pip install kats

Downgrade Packaging to 21.3

Change the line 178 in the site-packages\holidays\registry.py file in conda environment from super().init(*args, **kwargs) to super().init()

It worked like a charm, thanks! However, I would like to add that I ended up installing a specific version of the packaging library (conda install packaging=21.3) for kats to work.

@ferdinandyb
Copy link

@waqarahmed6095 conda install -c conda-forge kats fails for me in a new 3.7 conda env. I'm giving up on this for now.

@waqarahmed6095
Copy link

waqarahmed6095 commented May 23, 2023

no dont use conda install -c conda-forge kats directly. See the process
#308 (comment)
do first

conda install -c conda-forge fbprophet

This installation works for me.

Create conda environment in a particular directory

conda create --prefix ./env python=3.7

Install fbprophet

conda install -c conda-forge fbprophet

Install Kats

pip install kats

Downgrade Packaging to 21.3

Change the line 178 in the site-packages\holidays\registry.py file in conda environment from super().init(*args, **kwargs) to super().init()

@ferdinandyb
Copy link

ferdinandyb commented May 23, 2023 via email

@waqarahmed6095
Copy link

@ferdinandyb you have to do such installation for many libararies as they are not full maintainable

@crisjosil
Copy link

I'm not sure this would help anyone but just in case. The answer #308 (comment) helped me thanks, however it didn't work straight away. I had problems installing prophet. There are some open issues about it in the repository.
Using python 3.7 in a fresh environment, the following worked for me:

pip install numpy
pip install pandas
pip install convertdate
pip install lunarcalendar
pip install holidays==0.23
pip install tqdm
pip install pystan==2.19.1.1
pip install fbprophet==0.7.1
pip install kats
pip install Packaging==21.3

@thomashydeli
Copy link

@crisjosil's method works for me! looks like a quick and great solution at the moment

@SamuMazzi
Copy link

I'm not sure this would help anyone but just in case. The answer #308 (comment) helped me thanks, however it didn't work straight away. I had problems installing prophet. There are some open issues about it in the repository. Using python 3.7 in a fresh environment, the following worked for me:

pip install numpy pip install pandas pip install convertdate pip install lunarcalendar pip install holidays==0.23 pip install tqdm pip install pystan==2.19.1.1 pip install fbprophet==0.7.1 pip install kats pip install Packaging==21.3

Actually this used to give me the original problem, but using Python 3.8 solved it

@james-tyler1423
Copy link

james-tyler1423 commented Jun 1, 2023

I am now having the same issue. I have tried all of the things listed above and still no luck. The solution by @crisjosil doesn't work for me and using python 3.8 as @SamuMazzi suggested didn't work either. Now I'm stuck.

@juhik2992
Copy link

I'm having the same issue and I'm using python 3.11.2 any leads?

@wxl112
Copy link

wxl112 commented Jul 6, 2023

  1. first you have to open the "anaconda prompt" as a manager
  2. you have to Create conda environment in a particular directory, and remember activating it.
    conda create --(your env name) python=3.7
  3. Check if there is a distutils.cfg file in '\Lib\distutils' in your virtual environment path, and execute following command
    conda install libpython m2w64-toolchain -c msys2
    conda install numpy cython -c conda-forge
    conda install matplotlib scipy pandas -c conda-forge
    conda install pystan -c conda-forge
    conda install fbprophet -c conda-forge
    finally just
    pip install kats

@AmirrezaArabameri
Copy link

AmirrezaArabameri commented Jul 8, 2023

None of the proposed solutions worked for me directly, but they led me to find an absolute solution that works for me pretty well: (Windows 10)

Step 1: Install Anaconda on your system (https://www.anaconda.com/download)
Step 2: Create a fresh Environment on your Anaconda with Python 3.8
Step 3: Open the Terminal of the new Environment
Step 4: Install Ephem (https://anaconda.org/anaconda/ephem)
Step 5: Install Pystan (https://anaconda.org/conda-forge/pystan)
Step 6: Install Fbprophet (https://anaconda.org/conda-forge/fbprophet)
Step 7: Install Kats (https://anaconda.org/conda-forge/kats)
Step 8: Install Packaging 23.1 (https://anaconda.org/conda-forge/packaging/)
Step 9: Open Jupyter Notebook through the new Environment
Step 10: Import Kats library (from kats.consts import TimeSeriesData)
Step 11: Again install Packaging 23.1 (https://anaconda.org/conda-forge/packaging/)
Step 12: Run the cell

You have to always repeat Step 8 before using Kats if you don't want to get an Error!

@yannmean
Copy link

The above method works on Mac as well, just tested. One thing to recorrect, should be:
install Packaging 21.3 instead of 23.1. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests