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

Error while trying to import deepforest from deepforest #192

Closed
Berki20 opened this issue May 26, 2021 · 7 comments
Closed

Error while trying to import deepforest from deepforest #192

Berki20 opened this issue May 26, 2021 · 7 comments
Labels
bug Something isn't working installation wontfix This will not be worked on

Comments

@Berki20
Copy link

Berki20 commented May 26, 2021

Describe the bug
I have been using DeepForest for the past couple of months and everything went fine. However, today I tried to open the Google Notebook where I usually work in but i cant import deepforest from deepforest. The outputshows the following error: "module 'tensorflow._api.v1.compat.v2.compat' has no attribute 'v1'"

To Reproduce
Steps to reproduce the behavior:
!pip install DeepForest
!pip uninstall numpy
!pip install numpy
from deepforest import deepforest

Expected behavior
Import the module

Screenshots
image

Desktop (please complete the following information):

  • OS: [GoogleColab]
  • Browser [chrome]
  • Version [90]
@bw4sz
Copy link
Collaborator

bw4sz commented May 26, 2021 via email

@bw4sz
Copy link
Collaborator

bw4sz commented May 26, 2021

It looks like this well upstream of us, @henrykironde do you have time to look around as well. I'm seeing

Collecting DeepForest
  Downloading https://files.pythonhosted.org/packages/bc/e5/c378546777772b456bbc72188488a658496d2d0907e31ebf3b2519ef8b68/deepforest-0.3.8-cp37-cp37m-manylinux2010_x86_64.whl (9.3MB)
     |████████████████████████████████| 9.3MB 5.9MB/s 
Requirement already satisfied: progressbar2 in /usr/local/lib/python3.7/dist-packages (from DeepForest) (3.38.0)
Collecting tensorflow==1.14.0
  Downloading https://files.pythonhosted.org/packages/f4/28/96efba1a516cdacc2e2d6d081f699c001d414cc8ca3250e6d59ae657eb2b/tensorflow-1.14.0-cp37-cp37m-manylinux1_x86_64.whl (109.3MB)
     |████████████████████████████████| 109.3MB 92kB/s 
Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from DeepForest) (7.1.2)
Collecting pyyaml>5.1.0
  Downloading https://files.pythonhosted.org/packages/7a/a5/393c087efdc78091afa2af9f1378762f9821c9c1d7a22c5753fb5ac5f97a/PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl (636kB)
     |████████████████████████████████| 645kB 35.0MB/s 
Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from DeepForest) (1.4.1)
Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from DeepForest) (4.41.1)
Collecting xmltodict
  Downloading https://files.pythonhosted.org/packages/28/fd/30d5c1d3ac29ce229f6bdc40bbc20b28f716e8b363140c26eff19122d8a5/xmltodict-0.12.0-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from DeepForest) (1.15.0)
Requirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (from DeepForest) (4.1.2.30)
Collecting keras==2.3.0
  Downloading https://files.pythonhosted.org/packages/1b/18/2e1ef121e5560ac24c7ac9e363aa5fa7006c40563c989e7211aba95b793a/Keras-2.3.0-py2.py3-none-any.whl (377kB)
     |████████████████████████████████| 378kB 40.7MB/s 
Collecting slidingwindow
  Downloading https://files.pythonhosted.org/packages/9b/80/ce3b1a3a6f940a89da6fcacc20cad3cd9520456fdf85fc18328026973f30/slidingwindow-0.0.14-py3-none-any.whl
Collecting keras-resnet==0.1.0
  Downloading https://files.pythonhosted.org/packages/05/46/ad0b2d1a05d9497bd80c98a2c3f4d8be38a4601ace69af72814f5fafd851/keras-resnet-0.1.0.tar.gz
Collecting h5py==2.10.0
  Downloading https://files.pythonhosted.org/packages/3f/c0/abde58b837e066bca19a3f7332d9d0493521d7dd6b48248451a9e3fe2214/h5py-2.10.0-cp37-cp37m-manylinux1_x86_64.whl (2.9MB)
     |████████████████████████████████| 2.9MB 31.5MB/s 
Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from DeepForest) (1.1.5)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from DeepForest) (3.2.2)
Requirement already satisfied: python-utils>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from progressbar2->DeepForest) (2.5.6)
Requirement already satisfied: google-pasta>=0.1.6 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (0.2.0)
Collecting tensorboard<1.15.0,>=1.14.0
  Downloading https://files.pythonhosted.org/packages/91/2d/2ed263449a078cd9c8a9ba50ebd50123adf1f8cfbea1492f9084169b89d9/tensorboard-1.14.0-py3-none-any.whl (3.1MB)
     |████████████████████████████████| 3.2MB 30.1MB/s 
Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (0.4.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (1.1.2)
Requirement already satisfied: absl-py>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (0.12.0)
Requirement already satisfied: protobuf>=3.6.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (3.12.4)
Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (1.1.0)
Requirement already satisfied: wrapt>=1.11.1 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (1.12.1)
Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (0.36.2)
Requirement already satisfied: numpy<2.0,>=1.14.5 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (1.19.5)
Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (1.34.1)
Collecting tensorflow-estimator<1.15.0rc0,>=1.14.0rc0
  Downloading https://files.pythonhosted.org/packages/3c/d5/21860a5b11caf0678fbc8319341b0ae21a07156911132e0e71bffed0510d/tensorflow_estimator-1.14.0-py2.py3-none-any.whl (488kB)
     |████████████████████████████████| 491kB 34.7MB/s 
Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorflow==1.14.0->DeepForest) (0.8.1)
Collecting keras-applications>=1.0.6
  Downloading https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl (50kB)
     |████████████████████████████████| 51kB 7.3MB/s 
Requirement already satisfied: psutil in /usr/local/lib/python3.7/dist-packages (from slidingwindow->DeepForest) (5.4.8)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->DeepForest) (2018.9)
Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas->DeepForest) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->DeepForest) (1.3.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->DeepForest) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->DeepForest) (2.4.7)
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (1.0.1)
Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (56.1.0)
Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (3.3.4)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (4.0.1)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard<1.15.0,>=1.14.0->tensorflow==1.14.0->DeepForest) (3.4.1)
Building wheels for collected packages: keras-resnet
  Building wheel for keras-resnet (setup.py) ... done
  Created wheel for keras-resnet: filename=keras_resnet-0.1.0-py2.py3-none-any.whl size=13346 sha256=75c0c0acdbcf76771a71a3ff0537345c410d7e548c9025ef2c6e3e41de7a248e
  Stored in directory: /root/.cache/pip/wheels/80/dd/ac/842235b63dddac12faa4b48ebe58b8944e8c2e57c2e38dddb6
Successfully built keras-resnet
ERROR: kapre 0.3.5 has requirement tensorflow>=2.0.0, but you'll have tensorflow 1.14.0 which is incompatible.
Installing collected packages: tensorboard, tensorflow-estimator, h5py, keras-applications, tensorflow, pyyaml, xmltodict, keras, slidingwindow, keras-resnet, DeepForest
  Found existing installation: tensorboard 2.5.0
    Uninstalling tensorboard-2.5.0:
      Successfully uninstalled tensorboard-2.5.0
  Found existing installation: tensorflow-estimator 2.5.0
    Uninstalling tensorflow-estimator-2.5.0:
      Successfully uninstalled tensorflow-estimator-2.5.0
  Found existing installation: h5py 3.1.0
    Uninstalling h5py-3.1.0:
      Successfully uninstalled h5py-3.1.0
  Found existing installation: tensorflow 2.5.0
    Uninstalling tensorflow-2.5.0:
      Successfully uninstalled tensorflow-2.5.0
  Found existing installation: PyYAML 3.13
    Uninstalling PyYAML-3.13:
      Successfully uninstalled PyYAML-3.13
  Found existing installation: Keras 2.4.3
    Uninstalling Keras-2.4.3:
      Successfully uninstalled Keras-2.4.3
Successfully installed DeepForest-0.3.8 h5py-2.10.0 keras-2.3.0 keras-applications-1.0.8 keras-resnet-0.1.0 pyyaml-5.4.1 slidingwindow-0.0.14 tensorboard-1.14.0 tensorflow-1.14.0 tensorflow-estimator-1.14.0 xmltodict-0.12.0
[2]
from deepforest import deepforest

Keras-resnet has a dependency kapre, which has a tensorflow > 2.0 dependency.It looks like one of keras side libraries, totally unneeded for our work has a tensorflow pinned version. I'm looking for a workaround now.

https://pypi.org/project/kapre/

@bw4sz
Copy link
Collaborator

bw4sz commented May 26, 2021

@Berki20 i'm going to talk to upstream repos, but nothing immediately jumps out at me, you would have only minor code changes moving to https://deepforest-pytorch.readthedocs.io/en/latest/. I'd be interested in hearing if you see any performance differences, the release models are within 0.1% on our benchmark.

@Berki20
Copy link
Author

Berki20 commented May 27, 2021

@bw4sz hi Ben, thanks for reading the report so fast. I think im going to move to the pytorch version as it installs and runs perfectly in Colab and also because of keras is deprecated and i suppose they are not going to update it any more. I will keep you posted if I see any differences between both versions.

@henrykironde
Copy link
Contributor

kapre 0.3.5 latest release requires tensorflow >= 2.0.0 we are using tensorflow==1.14.
This will require us to move to tensorflow >= 2.0.0. I am no sure it will be compatible.

@bw4sz
Copy link
Collaborator

bw4sz commented May 30, 2021

Sure, I see that, I guess I meant what we can do to try to go beyond the requirements of upstream packages. We could fork Keras-resnet, remove the reference to Kapre and place it as a module in the repo. We don’t need its functionality.

@bw4sz bw4sz added bug Something isn't working installation tensorflow wontfix This will not be worked on labels Jun 8, 2021
@ethanwhite
Copy link
Member

Closing since we've moved over to PyTorch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working installation wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants