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

[2023 January] Changes required to run installation on macosx #381

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nirajpandkar
Copy link

  1. Dependency upgrades in setup.py
  2. tensorflow api change from tf.train to tf.compat.v1.train

If you are trying to follow these instructions to install - https://spinningup.openai.com/en/latest/user/installation.html, I had to do these changes in order to get it working on a MacBook pro 2019 version.

PS. Additional dependent libraries also required to successfully run the training (other than the instructions given on the installation page)

  1. pip install swig
  2. brew install freetype
  3. Command Line Tools for xcode: xcode-select --install (The dialog box says it'll take 200+ hours to complete so install it externally - https://developer.apple.com/download/all/?q=command)

@nirajpandkar nirajpandkar changed the title Changes required to run installation on macosx [2023 January]Changes required to run installation on macosx Jan 22, 2023
@nirajpandkar nirajpandkar changed the title [2023 January]Changes required to run installation on macosx [2023 January] Changes required to run installation on macosx Jan 22, 2023
@reaktor-esakoskinen
Copy link

reaktor-esakoskinen commented Mar 7, 2023

I arrived at almost exactly the same changes trying to install on an 2022 M1 Pro. However, since an M1-compatible TensorFlow wheel is not distributed through the normal Anaconda repositories, I had to take the additional steps documented here:
tensorflow/tensorflow#51506 (comment)

In order to get OpenGL rendering to work, I also needed pip install pyglet==1.5.15.

These might be useful to mention when the Gym's install instructions are updated.

There was also another PR with more comprehensive changes for TensorFlow 2 compatibility, but so far I didn't need them for running experiments:
#341

@KaiOnGitHub
Copy link

I additionally had to change tensorflow to tensorflow-macos<3.0 to support apple's GPU supported Tensorflow version.

Here are all commands that yielded a successful install for me (I already had the command line tools and used pipenv to create the python environment)

git clone https://github.com/openai/spinningup.git
cd spinningup
git fetch origin pull/381/head:2023Jan_dependency_upgrades
git checkout 2023Jan_dependency_upgrades
pipenv --python 3.9
pipenv shell
pip install swig
brew install freetype
pip install pyglet==1.5.15
pip install tensorflow-macos
pip install tensorflow-metal

replace 'tensorflow>=1.8.0,<3.0 in setup.py with:
'tensorflow>=1.8.0,<3.0; sys_platform != "darwin" or platform_machine != "arm64"',
'tensorflow-macos>=1.8.0,<3.0; sys_platform == "darwin" and platform_machine == "arm64"',

Finally run the install:
pip install -e .

I somehow had to run pip install pyglet==1.5.15 again.

@rojas70
Copy link

rojas70 commented Jun 15, 2023

Do we have the equivalent for linux ubuntu?

@Nos-Talion
Copy link

Nos-Talion commented Jul 14, 2023

I am sorry that I followed the instructions and successfully installed the spinningup but when I use the command python -m spinup.run test_policy data/installtest/installtest_s0, I got zsh: illegal hardware instruction python -m spinup.run test_policy data/installtest/installtest_s0. Could someone help me?

@mrvincenzo
Copy link

mrvincenzo commented May 24, 2024

worked like a charm on M1 with python 3.8.

  1. Apply changes from PR File Changes
  2. conda create -n spinningup python=3.8
  3. pip install -e .

More issues arise later with

python -m spinup.run plot
python -m spinup.run test_policy

after successful run of

python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999

How to fix python -m spinup.run plot ...?

  1. in setup.py replace
    'matplotlib==3.1.1' -> 'matplotlib==3.7.5'
    'seaborn==0.8.1' -> 'seaborn==0.13.2'

  2. Replace

sns.tsplot(data=data, time=xaxis, value=value, unit="Unit", condition=condition, ci='sd', **kwargs)

with

sns.lineplot(data=data, x=xaxis, y=value, hue=condition, ci="sd", **kwargs)

How to fix python -m spinup.run test_policy ...?

pip install pyglet==1.5.29

you will get an error message

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
gym 0.15.7 requires pyglet<=1.5.0,>=1.4.0, but you have pyglet 1.5.29 which is incompatible.

but the installation should succeed (verify with pip show pyglet)

@Nos-Talion
Copy link

Nos-Talion commented May 25, 2024 via email

@takeshi8989
Copy link

worked like a charm on M1 with python 3.8.

  1. Apply changes from PR File Changes
  2. conda create -n spinningup python=3.8
  3. pip install -e .

More issues arise later with

python -m spinup.run plot
python -m spinup.run test_policy

after successful run of

python -m spinup.run ppo --hid "[32,32]" --env LunarLander-v2 --exp_name installtest --gamma 0.999

How to fix python -m spinup.run plot ...?

  1. in setup.py replace
    'matplotlib==3.1.1' -> 'matplotlib==3.7.5'
    'seaborn==0.8.1' -> 'seaborn==0.13.2'
  2. Replace
sns.tsplot(data=data, time=xaxis, value=value, unit="Unit", condition=condition, ci='sd', **kwargs)

with

sns.lineplot(data=data, x=xaxis, y=value, hue=condition, ci="sd", **kwargs)

How to fix python -m spinup.run test_policy ...?

pip install pyglet==1.5.29

you will get an error message

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
gym 0.15.7 requires pyglet<=1.5.0,>=1.4.0, but you have pyglet 1.5.29 which is incompatible.

but the installation should succeed (verify with pip show pyglet)

I also had to run
pip install swig
And then
pip install -e .

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

Successfully merging this pull request may close these issues.

7 participants