lukas / ml-class

Machine learning lessons and teaching projects designed for engineers
https://www.youtube.com/channel/UCBp3w4DCEC64FZr4k9ROxig
GNU General Public License v2.0
2.37k stars 1.17k forks source link

conflicting requirements when installing from requirements.txt #40

Closed nogkaha closed 5 years ago

nogkaha commented 5 years ago

I've tried installing the dependencies using pipenv but got some errors:

[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
ERROR: ERROR: Could not find a version that matches keras-applications==1.0.2,>=1.0.6

After digging it seems like tensorflow requires keras-applications>=1.0.6 while forcing Keras==2.2.0 requires keras-applications>=1.0.2

tensorflow==1.13.1
  - absl-py [required: >=0.1.6, installed: 0.7.1]
    - six [required: Any, installed: 1.12.0]
  - astor [required: >=0.6.0, installed: 0.8.0]
  - gast [required: >=0.2.0, installed: 0.2.2]
  - grpcio [required: >=1.8.6, installed: 1.21.1]
    - six [required: >=1.5.2, installed: 1.12.0]
  - keras-applications [required: >=1.0.6, installed: 1.0.7]

Keras==2.2.0
  - h5py [required: Any, installed: 2.9.0]
    - numpy [required: >=1.7, installed: 1.16.3]
    - six [required: Any, installed: 1.12.0]
  - keras-applications [required: ==1.0.2, installed: 1.0.7]

Maybe you could slightly change the requirements? Thanks

vanpelt commented 5 years ago

Upgrading keras to 2.2.4 should fix it. I just updated our requirements.txt

nogkaha commented 5 years ago

So I did, but then got an error when running perceptron-single-fixed.py. I suspect the code is not compatible with the newer version of keras:

Traceback (most recent call last):
  File "perceptron-single-fixed.py", line 28, in <module>
    model.add(Dense(1), activation='sigmoid')
TypeError: add() got an unexpected keyword argument 'activation'

I was able to run it by changing the call to :

model.add(Dense(1))
model.add(Activation('sigmoid'))