robcarver17 / pysystemtrade

Systematic Trading in python
GNU General Public License v3.0
2.49k stars 798 forks source link

Clean install, PyYAML 5.4 error #1351

Open rorymac opened 3 months ago

rorymac commented 3 months ago

TLDR - PyYAML 5.4 has an error upon installation.

Clean install on Mint 21.3 Python version Python 3.10.12. PST version https://github.com/robcarver17/pysystemtrade/commit/05184ea82e2a456158573bd907c56568d8767da8

running pip install -r requirements.txt PyYAML fails to install

replaced with PyYAML 5.3.1 - no issues with that -

rorym@rory-vbox-21:~/pysystemtrade$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Collecting pandas==2.1.3
  Downloading pandas-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.3/12.3 MB 13.6 MB/s eta 0:00:00
Collecting matplotlib>=3.0.0
  Downloading matplotlib-3.8.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.6/11.6 MB 25.6 MB/s eta 0:00:00
Collecting pyyaml==5.4
  Downloading PyYAML-5.4.tar.gz (174 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.8/174.8 KB 11.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]
      running egg_info
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
          self.run_setup()
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 271, in <module>
          setup(
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
          return run_commands(dist)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 163, in run_commands
          dist.run_commands()
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 299, in run
          self.find_sources()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 306, in find_sources
          mm.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 541, in run
          self.add_defaults()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 578, in add_defaults
          sdist.add_defaults(self)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/sdist.py", line 228, in add_defaults
          self._add_defaults_ext()
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/sdist.py", line 312, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
        File "setup.py", line 201, in get_source_files
          self.cython_sources(ext.sources, ext)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 103, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Parti-Gyle commented 3 months ago

This isn't directly an issue with pyst, rather that PyYAML won't build from source with cython>=3.0.0 (see the PyYAML issue #602).

Can you try this work-around and see if PyYAML installs with:

python -m pip install --upgrade "cython<3.0.0"
python -m pip install --no-build-isolation pyyaml==5.4
python -m pip install --upgrade cython

I also noticed the master branch specifies pyyaml==5.4, where the develop branch specifies pyyaml==5.3.1, in requirements.txt. Does this need to be fixed?

rorymac commented 3 months ago

Thanks for your feedback, The latest master as you say has 5.4 specified, I am not sure why if develop has 5.3.1 The latest seems to be working, for the most part, I am on about my 4th VM to try and get everything to run. The master seems a tad fragile. I am attempting to migrate to the latest master.

I will continue to post whatever odd errors (that hopefully are not user error) that I encounter.