Installation Issue: '/usr/bin' exists but is not a virtual environment

Open
#522 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, r, tensorflow

Research direction

Start with the keras::install_keras() entry point and the reticulate::install_miniconda() setup described in the report, then inspect how virtualenv_install() handles /usr/bin. Reproduce on the reported Pop!_OS or Ubuntu environment using the supplied commands and diagnostic output. Done means installation no longer treats /usr/bin as a virtual environment and TensorFlow can be imported.

Written by the indexing model from the issue text.

Description

docs

I followed these instructions:

# install the development version of packages, in case the
# issue is already fixed but not on CRAN yet.
install.packages("remotes")
remotes::install_github(sprintf("rstudio/%s", c("reticulate", "tensorflow", "keras")))
reticulate::miniconda_uninstall() # start with a blank slate
options(timeout=300) # Missing from your instructions, 
                                   # but necessary given my ISP
reticulate::install_miniconda()
keras::install_keras()

And got the following error mesages:

* Miniconda has been successfully installed at "~/.local/share/r-miniconda".
[1] "/home/ralmond/.local/share/r-miniconda"
> keras::install_keras()
Error in virtualenv_install(envname = envname, packages = packages, ignore_installed = pip_ignore_installed,  : 
  '/usr/bin' exists but is not a virtual environment

This is just running under Pop_OS (Ubuntu derivative) 20.10. the miniconda installation worked fine under Mac_OS.

Diagnostic info:

> py_config()
python:         /usr/bin/python3.9
libpython:      /usr/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.so
pythonhome:     //usr://usr
version:        3.9.7 (default, Sep 10 2021, 14:59:43)  [GCC 11.2.0]
numpy:          /usr/lib/python3/dist-packages/numpy
numpy_version:  1.19.5
tensorflow:     [NOT FOUND]

NOTE: Python version was forced by RETICULATE_PYTHON
> tensorflow::tf_config()
Valid installation of TensorFlow not found.

Python environments searched for 'tensorflow' package:
 /usr/bin/python3.9

Python exception encountered:
 ModuleNotFoundError: No module named 'tensorflow'

You can install TensorFlow using the install_tensorflow() function.
 
> reticulate::import("tensorflow")
Error in py_module_import(module, convert = convert) : 
  ModuleNotFoundError: No module named 'tensorflow'
> reticulate::py_last_error()
$type
[1] "ModuleNotFoundError"

$value
[1] "No module named 'tensorflow'"

$traceback
[1] "  File \"/home/ralmond/R/x86_64-pc-linux-gnu-library/4.1/reticulate/python/rpytools/loader.py\", line 39, in _import_hook\n    module = _import(\n"

$message
[1] "ModuleNotFoundError: No module named 'tensorflow'"

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 21.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] reticulate_1.24

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8       lattice_0.20-45  png_0.1-7       
 [4] zeallot_0.1.0    rappdirs_0.3.3   grid_4.1.2      
 [7] R6_2.5.1         jsonlite_1.7.3   magrittr_2.0.2  
[10] tfruns_1.5.0     cli_3.2.0        rlang_1.0.1     
[13] whisker_0.4      Matrix_1.4-0     generics_0.1.2  
[16] keras_2.8.0      tools_4.1.2      xfun_0.29       
[19] compiler_4.1.2   base64enc_0.1-3  tensorflow_2.8.0
[22] knitr_1.37   
>
Dominant language
R
Stars
1.3k
Forks
316
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rstudio/tensorflow

All issues in rstudio/tensorflow

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.