Joblib doesn't work in Jupyter lab - scikit-learn

Firstly I use the joblib.dump command in my neural network training notebook, in order to dump my pipeline that is fitted on my input data:
joblib.dump(prepareinput, "prepareinput.save")
Then when I try to load the data in a different notebook in Jupyter lab using:
prepareinput = joblib.load('prepareinput.save')
It will return the following error:
No such file or directory: 'prepareinput.save'.
Whilst the file is present in the directory. Then when I export the notebook as script, it will run perfectly. I have also tried using the full path "~/..linktofile../prepareinput.save"
Does anyone have an idea on how to fix this issue?

Related

How to prevent chrome from opening on each run of a juypter notebook that generates a graphviz file?

I am running graphviz inside a jupyter notebook in vs code. Everytime I run a cell that generates a graphviz dot Windows sees the file and opens it in Chrome. It is also displayed inline in the jupyter notebook where I want it. How can I prevent Chrome from opening?
I've tried creating a launch.json as the project didn't have one. This didn't make a difference. I can't find any available configuration settings I can change to prevent Chrome opening.
To open a jupyter notebook or jupyter lab instance without displaying it in the browser, you have to open the jupyter instance on CMD using the following command. (Of course jupyter should be on path to use jupyter commands on cmd)
jupyter notebook --no-browser <path>
and similarly for jupyter lab:
jupyter lab --no-browser <path>
The path is optional, and if you dont add a path it simply open C:\ as your default path.
Really obvious answer. When I transitioned from running the .py file from the command line to the jupyter notebook I didn't comment out the dot.view() (a graphviz call) that displays the result graph. Jupyter will display the results without this. Duh.

Program failing to load image

I am trying to convert MNIST images into tensors and when I run the program I am getting the following error. I tried to re-install PyTorch but it did not help.
UserWarning: Failed to load image Python extension: Could not find module
'C:\Users\---\AppData\Roaming\Python\Python39\site-packages\torchvision\image.pyd'
(or one of its dependencies). Try using the full path with constructor syntax.

Sagemaker: continual fit error after one failure to fit

I am implementing some Sagemaker SKLearn examples:
https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk/scikit_learn_iris
https://github.com/awslabs/amazon-sagemaker-examples/tree/master/sagemaker-python-sdk/scikit_learn_randomforest
I can successfully run them and all is happy. However, if I deliberately introduce a bug into the training script .py file, for example by adding
import boto3
which fails because boto3 is not installed on the training docker image, then for the iris example I get the error
UnexpectedStatusException: Error for Training job sagemaker-scikit-learn-2019-09-30-05-13-53-184: Failed. Reason: AlgorithmError: ExecuteUserScriptError:
Command "/usr/bin/python3 -m train --max_leaf_nodes 30"
and a similar error for the random_forest example. That is all fine.
What I do not understand is that when I remove the offending line of code from the script, returning to precisely the code which had already ran successfully, I get the same error.
I have tried stopping and re-starting the notebook instance but the error remains.

"DLL load failed: The specified module could not be found" error on using wordcloud in Jupyter notebook

I installed the word cloud library in python to use wordcloud. I am able to successfully use it in all editors like sublime, etc but when I am trying to use it in Jupyter notebook then it is giving me error:
DLL load failed: The specified module could not be found
I have been trying to solve this issue from last 2 days but not getting success. I would appreciate any kind of help.
I too faced this issue.
the problem was when wordcloud is installed it gets python modules and stores in
**C:\Python27\Lib\site-packages** folder (in my case this is the python executable path this may vary for you) so when you import from jupyter it tries to find it in this path , but wordcloud creates one more folder with same name and downloads all wordcloud module in side this , this is one more level in directory so jupyter is unable to find. so the hack what i did is copied all modules from inner wordclod folder to one level outside i.e
copy all from C:\Python27\Lib\site-packages\wordcloud\wordcloud ->
C:\Python27\Lib\site-packages\wordcloud
so this made the trick and no more error.

Keras CNTK stops working when I train the model

I have changed keras backend to "cntk" in keras.json file.
When I execute my python file execute
it stops working.
stop-working image
But when I use tensorflow/theano is working normally.
Why?
----------update
image-pycharm
When pycharm Found images(image-pycharm) ,it stop suddenly.
And then I try to use cmd to execute my python file.
The result is "The system stop working"

Resources