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

R Studio numpy version #436

Open
lve0200 opened this issue Feb 22, 2019 · 8 comments
Open

R Studio numpy version #436

lve0200 opened this issue Feb 22, 2019 · 8 comments

Comments

@lve0200
Copy link

lve0200 commented Feb 22, 2019

Please refer to the following stack overflow message
https://stackoverflow.com/questions/51541031/numpy-version-is-not-satisfied-for-tensorflow
Error in py_dict_impl(keys, values, convert = convert) : Evaluation error: Required version of NumPy not available: installation of Numpy >= 1.6 not found
The issue seems to be here:
# check numpy version and provide a load error message if we don't satisfy it if (is.null(config$numpy) || config$numpy$version < "1.6") numpy_load_error <- "installation of Numpy >= 1.6 not found" else
Please note, that the version is found in R, there seems just to be a difficulty to interpret the version w/ 2 dots. Please see the follwing output from R
` np <- reticulate::import("numpy")

print(np$version$full_version)
[1] "1.15.4"
`

Hence there is no env/path issue!
I would compile a new version, if I would know, how to clone and compile in Windows for Windows 10. When I installed it, it did compile by itself (hence I have the necessary tools installed as cc, make etc. but I don't know, how to use them in windows.
Thanks

@kevinushey
Copy link
Collaborator

Can you please share what the output of the following is?

library(reticulate)
config <- py_config()
config$numpy

It's more likely that reticulate is unable to find or load numpy during initialization for some reason.

@kevinushey
Copy link
Collaborator

For reference I have:

> library(reticulate)
> config <- py_config()
> config$numpy
$path
[1] "/Users/kevin/Library/Python/2.7/lib/python/site-packages/numpy"

$version
[1] '1.15.4'

@lve0200
Copy link
Author

lve0200 commented Feb 22, 2019

Thanks for the question, things getting strange here...
That's what I get:

`> library(reticulate)

config <- py_config()
config$numpy
NULL
np <- reticulate::import("numpy")
print(np$version$full_version)
[1] "1.15.4"
print(config)
python: C:\Users\hk\Anaconda3\envs\r-tensorflow\python.exe
libpython: C:/Users/hk/Anaconda3/envs/r-tensorflow/python36.dll
pythonhome: C:\Users\hk\ANACON1\envs\R-TENS1
version: 3.6.8 |Anaconda, Inc.| (default, Feb 11 2019, 15:03:47) [MSC v.1915 64 bit (AMD64)]
Architecture: 64bit
numpy: [NOT FOUND]
tensorflow: C:\Users\hk\ANACON1\envs\R-TENS1\lib\site-packages\tensorflow_init_.p

python versions found:
C:\Users\hk\Anaconda3\envs\r-tensorflow\python.exe
C:\Users\hk\ANACON~1\python.exe
C:\Users\hk\Anaconda3\python.exe`

@lve0200
Copy link
Author

lve0200 commented Feb 22, 2019

just adding the call stack from R-Studio

`Error in py_call_impl(callable, dots$args, dots$keywords) :
Evaluation error: Required version of NumPy not available: installation of Numpy >= 1.6 not found.
In addition: Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :

Hide Traceback

Rerun with Debug
Error in py_call_impl(callable, dots$args, dots$keywords) :
Evaluation error: Required version of NumPy not available: installation of Numpy >= 1.6 not found.
18.
stop(structure(list(message = "Evaluation error: Required version of NumPy not available: installation of Numpy >= 1.6 not found.",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = NULL), class = c("Rcpp::eval_error", "C++Error",
"error", "condition")))
17.
py_call_impl(callable, dots$args, dots$keywords)
16.
tensorflow::tf$contrib$framework$is_tensor(x)
15.
keras_array(x)
14.
fit.keras.engine.training.Model(., x, y, epochs = 30, batch_size = 128,
validation_split = 0.2) `

@lve0200
Copy link
Author

lve0200 commented Feb 22, 2019

I see in
print (config$required_module_path)
[1] "C:\Users\hk\ANACON1\envs\R-TENS1\lib\site-packages\tensorflow\init.p"
is there eventually an "y" missing at the end, because the file in the directory is init.py !! ??

@lve0200
Copy link
Author

lve0200 commented Feb 22, 2019

sorry, if things are getting confused!
I did a complete fresh install of Keras and keras_install(method="conda")
Everything worked through, but I got a
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Users\hk\ANACON-1\envs\rstudio/python.exe": Das System kann die angegebene Datei nicht finden (not found)
I get the same warning, when executing
library(reticulate)

config <- py_config()
Warning message:
In normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:\Users\hk\ANACON-1\envs\rstudio/python.exe": Das System kann die angegebene Datei nicht finden
config$numpy
NULL
I then copied python.exe from ../tensorflow to ../rstudio
Now, it apeared working
library(reticulate)
config <- py_config()
config$numpy
$path
[1] "C:\Users\hk\ANACON-1\envs\R-TENS~1\lib\site-packages\numpy"

$version
[1] ‘1.15.4’

but just to get another error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'Sequential' object has no attribute 'shape'
13.
stop(structure(list(message = "AttributeError: 'Sequential' object has no attribute 'shape'",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = structure(list(file = "", line = -1L, stack = "C++ stack not available on this system"), class = "Rcpp_stack_trace")), class = c("Rcpp::exception",
"C++Error", "error", "condition")))
12.
layer(object)
11.
compose_layer.python.builtin.object(object, layer)
10.
compose_layer(object, layer)
9.
create_layer(keras$layers$Dense, object, list(units = as.integer(units),
activation = activation, use_bias = use_bias, kernel_initializer = kernel_initializer,
bias_initializer = bias_initializer, kernel_regularizer = kernel_regularizer,
bias_regularizer = bias_regularizer, activity_regularizer = activity_regularizer, ...
8.
layer_dense(., units = 256, activation = "relu", input_shape = c(12))
7.
function_list[i]
6.
freduce(value, _function_list)
5.
_fseq(_lhs)
4.
eval(quote(_fseq(_lhs)), env, env)
3.
eval(quote(_fseq(_lhs)), env, env)
2.
withVisible(eval(quote(_fseq(_lhs)), env, env))
1.
model %>% layer_dense(units = 256, activation = "relu", input_shape = c(12)) %>%
layer_dropout(rate = 0.4) %>% layer_dense(units = 128, activation = "relu") %>%
layer_dropout(rate = 0.3) %>% layer_dense(units = 10, activation = "softmax")

@microly
Copy link

microly commented Jun 2, 2019

Maybe this issue can be referenced to #367.

@microly
Copy link

microly commented Jun 2, 2019

I find the solution from #367 .

you can try:
Sys.setenv(PATH= paste("D:/DEVTOOLS/Anaconda2/envs/py37/Library/bin",Sys.getenv()["PATH"],sep=";"))
Sys.setenv(RETICULATE_PYTHON = "D:/DEVTOOLS/Anaconda2/envs/py37/python.exe")
library(reticulate)

Or

load R/Rstudio from a conda command prompt that has already set the PATH correctly.

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