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

setup.py requirements on mac os #231

Closed
gdupret opened this issue May 3, 2022 · 7 comments
Closed

setup.py requirements on mac os #231

gdupret opened this issue May 3, 2022 · 7 comments

Comments

@gdupret
Copy link

gdupret commented May 3, 2022

At least for M1 machine:

from setuptools import setup

setup(
    name='keras-tcn',
    version='3.4.2',
    description='Keras TCN',
    author='Philippe Remy',
    license='MIT',
    long_description_content_type='text/markdown',
    long_description=open('README.md').read(),
    packages=['tcn'],
    install_requires=[
        'numpy', 'tensorflow-macos', 'tensorflow_addons'
    ]
)

instead of

    install_requires=[
        'numpy', 'tensorflow', 'tensorflow_addons'
    ]
@philipperemy
Copy link
Owner

@gdupret do you have examples of other repos? I'm not sure about the best way to do that.

@psomers3
Copy link
Contributor

psomers3 commented May 6, 2022

maybe simply just something like:

import platform
tensorflow = 'tensorflow'
if platform.system() == "Darwin" and platform.processor() == 'arm':
    tensorflow = 'tensorflow-macos'

install_requires = ['numpy', tensorflow, 'tensorflow_addons']

@philipperemy
Copy link
Owner

@psomers3 fair enough :)

@philipperemy
Copy link
Owner

philipperemy commented May 6, 2022

@gdupret can you try to run this pip install and let me know if it works on your Mac M1?

pip install keras-tcn-macos==1.0

If it does not work, you might have to run some of those commands beforehand:

brew install hdf5@1.8 <----------------------- select the right version
export HDF5_DIR=/opt/homebrew/Cellar/hdf5@1.8/1.8.22_2 <----------------------- here the right path

export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1

The two problematic packages are grpcio and h5py.

For info here is the command output I have on my Mac M1:

>>>>>>>>> philipperemy@Philippes-MacBook-Pro /tmp %  virtualenv -p python3.9 venv
created virtual environment CPython3.9.10.final.0-64 in 111ms
  creator CPython3Posix(dest=/private/tmp/venv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/premy/Library/Application Support/virtualenv)
    added seed packages: pip==22.0.4, setuptools==62.0.0, wheel==0.37.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator


>>>>>>>>> philipperemy@Philippes-MacBook-Pro /tmp %  source venv/bin/activate


>>>>>>>>> (venv) philipperemy@Philippes-MacBook-Pro /tmp %  pip install keras-tcn-macos==1.0

Collecting keras-tcn-macos==1.0
  Downloading keras_tcn_macos-1.0-py3-none-any.whl (13 kB)
Collecting tensorflow-addons
  Using cached tensorflow_addons-0.16.1-cp39-cp39-macosx_11_0_arm64.whl (545 kB)
Collecting tensorflow-macos
  Using cached tensorflow_macos-2.8.0-cp39-cp39-macosx_11_0_arm64.whl (190.1 MB)
Collecting numpy
  Using cached numpy-1.22.3-cp39-cp39-macosx_11_0_arm64.whl (12.8 MB)
Collecting typeguard>=2.7
  Using cached typeguard-2.13.3-py3-none-any.whl (17 kB)
Collecting libclang>=9.0.1
  Using cached libclang-14.0.1-py2.py3-none-macosx_11_0_arm64.whl (11.8 MB)
Collecting six>=1.12.0
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting absl-py>=0.4.0
  Using cached absl_py-1.0.0-py3-none-any.whl (126 kB)
Collecting tensorboard<2.9,>=2.8
  Using cached tensorboard-2.8.0-py3-none-any.whl (5.8 MB)
Collecting typing-extensions>=3.6.6
  Using cached typing_extensions-4.2.0-py3-none-any.whl (24 kB)
Collecting h5py>=2.9.0
  Using cached h5py-3.6.0-cp39-cp39-macosx_12_0_arm64.whl
Collecting grpcio<2.0,>=1.24.3
  Using cached grpcio-1.46.0-cp39-cp39-macosx_12_0_arm64.whl
Collecting termcolor>=1.1.0
  Using cached termcolor-1.1.0-py3-none-any.whl
Collecting protobuf>=3.9.2
  Using cached protobuf-3.20.1-py2.py3-none-any.whl (162 kB)
Collecting flatbuffers>=1.12
  Using cached flatbuffers-2.0-py2.py3-none-any.whl (26 kB)
Collecting keras<2.9,>=2.8.0rc0
  Using cached keras-2.8.0-py2.py3-none-any.whl (1.4 MB)
Collecting tf-estimator-nightly==2.8.0.dev2021122109
  Using cached tf_estimator_nightly-2.8.0.dev2021122109-py2.py3-none-any.whl (462 kB)
Collecting gast>=0.2.1
  Using cached gast-0.5.3-py3-none-any.whl (19 kB)
Collecting wrapt>=1.11.0
  Using cached wrapt-1.14.1-cp39-cp39-macosx_11_0_arm64.whl (35 kB)
Requirement already satisfied: setuptools in ./venv/lib/python3.9/site-packages (from tensorflow-macos->keras-tcn-macos==1.0) (62.0.0)
Collecting keras-preprocessing>=1.1.1
  Using cached Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
Collecting opt-einsum>=2.3.2
  Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB)
Collecting astunparse>=1.6.0
  Using cached astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting google-pasta>=0.1.1
  Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB)
Requirement already satisfied: wheel<1.0,>=0.23.0 in ./venv/lib/python3.9/site-packages (from astunparse>=1.6.0->tensorflow-macos->keras-tcn-macos==1.0) (0.37.1)
Collecting google-auth<3,>=1.6.3
  Using cached google_auth-2.6.6-py2.py3-none-any.whl (156 kB)
Collecting werkzeug>=0.11.15
  Using cached Werkzeug-2.1.2-py3-none-any.whl (224 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Using cached google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Collecting tensorboard-data-server<0.7.0,>=0.6.0
  Using cached tensorboard_data_server-0.6.1-py3-none-any.whl (2.4 kB)
Collecting tensorboard-plugin-wit>=1.6.0
  Using cached tensorboard_plugin_wit-1.8.1-py3-none-any.whl (781 kB)
Collecting markdown>=2.6.8
  Using cached Markdown-3.3.7-py3-none-any.whl (97 kB)
Collecting requests<3,>=2.21.0
  Using cached requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting rsa<5,>=3.1.4
  Using cached rsa-4.8-py3-none-any.whl (39 kB)
Collecting pyasn1-modules>=0.2.1
  Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting cachetools<6.0,>=2.0.0
  Using cached cachetools-5.0.0-py3-none-any.whl (9.1 kB)
Collecting requests-oauthlib>=0.7.0
  Using cached requests_oauthlib-1.3.1-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata>=4.4
  Using cached importlib_metadata-4.11.3-py3-none-any.whl (18 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.3-py3-none-any.whl (61 kB)
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting urllib3<1.27,>=1.21.1
  Using cached urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Collecting zipp>=0.5
  Using cached zipp-3.8.0-py3-none-any.whl (5.4 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting oauthlib>=3.0.0
  Using cached oauthlib-3.2.0-py3-none-any.whl (151 kB)
Installing collected packages: tf-estimator-nightly, termcolor, tensorboard-plugin-wit, pyasn1, libclang, keras, flatbuffers, certifi, zipp, wrapt, werkzeug, urllib3, typing-extensions, typeguard, tensorboard-data-server, six, rsa, pyasn1-modules, protobuf, oauthlib, numpy, idna, gast, charset-normalizer, cachetools, tensorflow-addons, requests, opt-einsum, keras-preprocessing, importlib-metadata, h5py, grpcio, google-pasta, google-auth, astunparse, absl-py, requests-oauthlib, markdown, google-auth-oauthlib, tensorboard, tensorflow-macos, keras-tcn-macos
Successfully installed absl-py-1.0.0 astunparse-1.6.3 cachetools-5.0.0 certifi-2021.10.8 charset-normalizer-2.0.12 flatbuffers-2.0 gast-0.5.3 google-auth-2.6.6 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.46.0 h5py-3.6.0 idna-3.3 importlib-metadata-4.11.3 keras-2.8.0 keras-preprocessing-1.1.2 keras-tcn-macos-1.0 libclang-14.0.1 markdown-3.3.7 numpy-1.22.3 oauthlib-3.2.0 opt-einsum-3.3.0 protobuf-3.20.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.27.1 requests-oauthlib-1.3.1 rsa-4.8 six-1.16.0 tensorboard-2.8.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.1 tensorflow-addons-0.16.1 tensorflow-macos-2.8.0 termcolor-1.1.0 tf-estimator-nightly-2.8.0.dev2021122109 typeguard-2.13.3 typing-extensions-4.2.0 urllib3-1.26.9 werkzeug-2.1.2 wrapt-1.14.1 zipp-3.8.0

@gdupret
Copy link
Author

gdupret commented May 6, 2022

I made a clean install on a virtual environment,pip install keras-tcn-macos==1.0 and ran tasks/exchange_rate/demo.ipynb successfully. Thank you for the fix!

@philipperemy
Copy link
Owner

@gdupret okay then I'll push it to the main branch then!

@philipperemy
Copy link
Owner

philipperemy commented May 7, 2022

The compatibility with MacOS was pushed in 3.4.3. Please install it that way: pip install --no-binary keras-tcn keras-tcn

The wheel was made for Linux and not for the Mac M1. Using --no-binary forces pip to download the sources and compile it.

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

3 participants