datacamp / datacamp-light

Convert any blog or website to an interactive learning platform for data science
GNU Affero General Public License v3.0
1.31k stars 358 forks source link

Keras DataCamp Light Chunks - Fail because of runtime error #78

Closed Kacawi-zz closed 6 years ago

Kacawi-zz commented 6 years ago

The Issue

I get the following error messages from the DataCamp Light chunks that are embedded in this keras R tutorial:

DataCamp encountered the following error during init:
Error: Fail because of runtime error: Error loading Python module keras
DataCamp encountered the following error during init:
Error: Fail because of runtime error: package or namespace load failed for 'keras':
 .onLoad failed in loadNamespace() for 'keras', details:
  call: py_module_import(module, convert = convert)
  error: ImportError: No module named keras

Reproduce?

You can reproduce the error by going to the tutorial and trying to run any of the chunks towards the end in which the Keras model is constructed.

filipsch commented 6 years ago

@Kacawi can you provide me with the exact code that is failing? That way I don't have to reverse-engineer that from the DCL chunks.

Kacawi-zz commented 6 years ago

@filipsch I can try to see if I can find the code back but I'm fairly unoptimistic about that one since there wasn't any version control. Nevertheless, I wanted to add to the original issue that I also see the following in some cases:

Error: Python module keras was not found.

Detected Python configuration:

python:         /usr/bin/python
libpython:      /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
pythonhome:     /usr:/usr
version:        2.7.12 (default, Dec  4 2017, 14:50:18)  [GCC 5.4.0 20160609]
numpy:          /usr/local/lib/python2.7/dist-packages/numpy
numpy_version:  1.14.2
keras:          [NOT FOUND]

I will try to see if I can update this issue with the exact code that is failing but it seems to go wrong already at the import.

Kacawi-zz commented 6 years ago

I remember that the installation of the R keras package was a difficult one because Keras is a wrapper on TensorFlow and you had to do some magic to get that to work with R. I think the issue is related to that.

filipsch commented 6 years ago

@Kacawi I managed to find a chunk of code that is not working:

library(keras)
iris <- read.csv(url("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"), header = FALSE) 
names(iris) <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species")
iris[,5] <- as.numeric(iris[,5]) -1
iris <- as.matrix(iris)
dimnames(iris) <- NULL
ind <- sample(2, nrow(iris), replace=TRUE, prob=c(0.67, 0.33))
iris.training <- iris[ind==1, 1:4]
iris.test <- iris[ind==2, 1:4]
iris.trainingtarget <- iris[ind==1,5]
iris.testtarget <- iris[ind==2, 5]
iris.trainLabels <- to_categorical(iris.trainingtarget)
iris.testLabels <- to_categorical(iris.testtarget)
model <- keras_model_sequential() 
model %>% 
    layer_dense(units = 8, activation = 'relu', input_shape = c(4)) %>% 
    layer_dense(units = 3, activation = 'softmax')

It goes wrong in the iris.testLabels <- to_categorical(iris.testtarget) step, with this error:

Error: Python module keras was not found.

Detected Python configuration:

python:         /usr/bin/python
libpython:      /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
pythonhome:     /usr:/usr
version:        2.7.12 (default, Dec  4 2017, 14:50:18)  [GCC 5.4.0 20160609]
numpy:          /usr/local/lib/python2.7/dist-packages/numpy
numpy_version:  1.14.2
keras:          [NOT FOUND]

I'll look into it as soon as I find the time.

filipsch commented 6 years ago

@Kacawi A fix is deployed. The Docker image is now rebuilding, which can take quite some time. I'll keep an eye on it, and is soon as it finished, I'll check again if it works properly this time, and activate afterwards. I'll keep you posted.

filipsch commented 6 years ago

@Kacawi should be good now

filipsch commented 6 years ago

Still not working. Continuing to investigate.

filipsch commented 6 years ago

@Kacawi A fix is deployed. The Docker image is now rebuilding, which can take quite some time. I'll keep an eye on it, and is soon as it finished, I'll check again if it works properly this time, and activate afterwards. I'll keep you posted. 😉

Kacawi-zz commented 6 years ago

@filipsch Thanks a lot!!

filipsch commented 6 years ago

@Kacawi should be up. Can you verify and close if it works?

filipsch commented 6 years ago

@Kacawi confirmed it works.

Nicky56 commented 5 years ago

Hmm, tried it today still not working ...