Install alpaca_trading_api

I have tried to install alpaca_trade_api several times with pip, and each time the following error occurs:
Collecting PyYAML==6.0 (from alpaca_trade_api)
  Using cached PyYAML-6.0.tar.gz (124 kB)
  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
  ╰─> [54 lines of output]
      running egg_info
      writing lib\PyYAML.egg-info\PKG-INFO
      writing dependency_links to lib\PyYAML.egg-info\dependency_links.txt
      writing top-level names to lib\PyYAML.egg-info\top_level.txt

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.
To solve it, I performed the following actions on the advice of GPT and Bard:
•	Uninstalled and reinstalled PyYAML (with pip and by downloading the .whl file directly from the website - https://pypi.org/project/PyYAML/), Pandas, and Cython.
•	Updated pip
But I'm still stuck. Can you tell me why?
I am using Python 3.12 64-bit.

@Camillo The alpaca-trading-api doesn’t support python versions above 3.8 and is understandable it may run into install issues with version 3.12. You can either load python 3.8 or use the newer alpaca-py SDK instead. That should work.

Thank you so much, do you suggest to use the older version of python or the newer alpaca-py? Because I’ve seen on the web that there are lot of tutorials that refer to alpaca-trading-api but none to alpaca-py…I don’t know if there’s a difference, but I had already installed Alpaca-py, and some commands that required the import of Alpaca-trade-api were not working.

@Camillo I personally use the original alpaca-trading-api partly because I have a lot of code that used that SDK but also because it’s a bit more ‘friendly’. What I mean by that is the newer alpaca-py SDK expects just about everything to be an object whereas alpaca-trading-api accepts simple strings for most inputs and parameters.

Especially if you are using examples which use the alpaca-trading-api SDK you may want to revert to an earlier supported version of python.

Do you by chance use Google Colab. I highly recommend that as a very convenient way to access all the Alpaca APIs in a python notebook environment. It’s free and easy to load the SDKs and are pretty much guaranteed to work using the default Colab notebook versions.

Ok, thank you so much for your support! I will try google collab