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

How to install optimizer AdaMod into Keras/Reticulate virtual environment? #2

Open
faltinl opened this issue Jun 24, 2020 · 2 comments

Comments

@faltinl
Copy link

faltinl commented Jun 24, 2020

I am working with Keras for R to experiment with neural networks and I use a Conda virtual environment under Reticulate to occasionally access additional Python packages. My attempt to install optimizer AdaMod, however, fails. I keep getting the following results (to be seen within R under RStudio):

> library(reticulate)
> conda_list()
          name                                         python
1   Miniconda3                     C:\\Miniconda3\\python.exe
2 r-reticulate C:\\Miniconda3\\envs\\r-reticulate\\python.exe
> reticulate::use_virtualenv("C:\\Miniconda3\\envs\\r-reticulate")

Thus, my virtual environment is there and working. Now I continue:

> py_install("adamod")
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##
  environment location: C:\Miniconda3\envs\r-reticulate
  added / updated specs:
    - python
The following packages will be downloaded:
    package                    |            build
    ---------------------------|-----------------
    certifi-2020.6.20          |           py36_0         156 KB
    ------------------------------------------------------------
                                           Total:         156 KB

The following packages will be UPDATED:
  certifi                                 2020.4.5.1-py36_0 --> 2020.6.20-py36_0

Downloading and Extracting Packages
certifi-2020.6.20    | 156 KB    | ########## | 100% 
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:
  - adamod
Current channels:
  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
    https://anaconda.org
and use the search bar at the top of the page.

Error: one or more Python packages failed to install [error code 1]

Under the address https://anaconda.org I can't find anything useful.
Question: how should I proceed to get the AdaMod package installed and available within my R environment as required?
Thanks in advance for any useful hint!

Note: This issue is related to the issue Transfer of a new Python optimizer to Keras in R rstudio /
keras #1049

@karrynest
Copy link
Collaborator

Tensorflow 2.0 version:
https://github.com/evanatyourservice/AdaMod-tf

Keras + Tensorflow 1.x version of AdaMod if anyone interested
https://github.com/superkido511/AdaMod-Keras

Hope this can help you :)

@faltinl
Copy link
Author

faltinl commented Jul 1, 2020

Hi, karrynest and tnx for support and suggestions. In R, i.e. under RStudio, i.e. activated my virtual environment r-reticulate and used it to start the installation process:

> library(reticulate)
> conda_list()
          name                                         python
1   Miniconda3                     C:\\Miniconda3\\python.exe
2 r-reticulate C:\\Miniconda3\\envs\\r-reticulate\\python.exe
> use_condaenv("r-reticulate")
> reticulate::py_install(c("https://github.com/superkido511/AdaMod-Keras"), pip = TRUE)

and got the following answer:

Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done
# All requested packages already installed.
Collecting https://github.com/superkido511/AdaMod-Keras
  Downloading https://github.com/superkido511/AdaMod-Keras  ### NOTE: apparently download is working, however...###
  ERROR: Cannot unpack file C:\Users\lf\AppData\Local\Temp\pip-unpack-oc97rttd\AdaMod-Keras 
               (downloaded from C:\Users\lf\AppData\Local\Temp\pip-req-build-7ft3wqj5, content-type: text/html; charset=utf-8); 
               cannot detect archive format
  ERROR: Cannot determine archive format of C:\Users\lf\AppData\Local\Temp\pip-req-build-7ft3wqj5
Error: Error installing package(s): "https://github.com/superkido511/AdaMod-Keras"

Using the other address provided for AdaMod-tf produces exactly the same error message. So there is some problem with unpacking the Python packages. Any idea what could be wrong?

I really don't understand why this process didn't produce the expected result, because it worked quite well in other cases.

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

2 participants