Copy and Pasting virtual environment to work on another machine - linux-kernel

Before my hdd got destroyed I was working on this virtual environment.
Where I have installed all the necessary packages like python, jupyter notebook. I used to run jupyter notebook using terminal. Then I replaced my hdd and copied the whole virtual environment. But now its saying permission denied.
There was an article explaining you need to use chmod u+x appname but it is not working
Previously I used to write in terminal like.
source virtualenvironment/bin/activate
jupyter-notebook
After entering jupyter-notebook it should run the notebook

Simply copying and pasting will not work as there may be paths that are not being set. So you simply need to create virtual environment again with same name. Then inside the virtual environment you need to install the same packages. Note that all the requirements must be fulfilled but this time the paths are also set. So running packages now will work fine.

Related

Jupyter Lab shows last used folder as the root directory when run from terminal (can't go up), but it's ok when run from Anaconda

I've been using Anaconda and Jupyter Lab & Notebook for a couple of months. I have 4 environments and had the usual problems I guess everyone has with package conflicts and such.
Today, when I was running a ipynb file in Jupyter Lab (run from Terminal), it got stuck when iterating over files and unzipping them, so I rebooted my Mac.
When I entered Jupyter Lab again, the folder it showed in the file browser was the last one I had used. It didn't have the option of going up, and if I entered a path in "open from path", it said that it couldn't find it. It's like the last folder I used is now considered the root path.
I tried running Jupyter Lab again from terminal, but same thing.
Of course, other environments weren't affected.
I thought it was a Jupyter Lab configuration problem, but when I run Jupyter Lab from Anaconda, it went back to working perfectly, so I'm wondering if there is a configuration setup specifically for Terminal.
I can work from Anaconda, and I can also reinstall the environment if needed, but I'd prefer to go back working the way I was.
Jupyter Notebook works fine.
Can anyone shed a light on what can be happening?
Thanks!
I tried:
reboot the computer
exit and reenter Jupyter Lab
go to "open from path"
search for jupyter config file with "jupyter --config-dir". Found "default-37a8.jupyterlab-workspace" in the /User/.jupyer/lab/workspaces folder, and it has the initial config for Jupyter Lab (directory, files opened), but it takes the info from when I close the instance I run from Anaconda. When run from terminal it's like it takes the initial config from somewhere else.

How to run RediSearch module with Redis on WSL (Windows Subsystem for Linux)

I followed the steps on https://redislabs.com/blog/redis-on-windows-10/ and have installed Ubuntu 18.04 and am successfully running Redis v4.09 on Windows. But, when following the steps on https://oss.redislabs.com/redisearch/Quick_Start/, I have some issues.
In the download and running binaries section, I don't understand what I'm supposed to replace /path/to/module/src/redisearch.so with. I've downloaded RediSearch for Ubuntu 18.04 and I've moved the files to a folder named RediSearch within my Downloads folder. Could someone help me with the pathing considering I'm using Ubuntu on Windows? I've also tried it with Building and Running with Source section but that just runs into an error every time I run make:
*** No rule to make target 'build'. Stop.
How can I run the module with Redis?
With WSL, you have access to C: through /mnt/c/ from Linux.
So, if you really want to have redisearch on a folder in Downloads you need to use something like:
/mnt/c/Users/<yourUser>/Downloads/yourFolder/src/redisearch.so
However, you probably should use a folder within Linux instead. You can use wget to download from Linux.

How to create a desktop-entry for anaconda on Ubuntu 17.10?

I've recently installed anaconda3 in Ubuntu 17.10 (system environment). To run anaconda-navigator, I've to activate root for each time as
Source ~/anaconda3/bin/activate root
And to run it I've to write each time
anaconda-navigator
Now I am wanted to create a desktop entry but I'm having errors at multiple stages. Can you please explain from beginning how to create a desktop-entry for anaconda3 on Linux?
EDIT: I've tried using this post on AskUbuntu. But, it failed for me. It is not showing on dock-bar as well as in /usr/share/applications. I'm really frustrated.
First, check if anaconda3 is installed on your system or not (Sometime the package may be broken due to network issues during installation (Not worked for me)). And whether you are able to launch anaconda-navigator without a desktop entry.
For creating a desktop entry
Step 1. Open your text editor and save the following content as Anaconda.desktop to your home directory.
[Desktop Entry]
Version=1.0
Type=Application
Name=Anaconda-Navigator
GenericName=Anaconda
Comment=Scientific Python Development Environment - Python3
Exec='$HOME/anaconda3/bin/anaconda-navigator'
Categories=Development;Science;IDE;Qt;Education;
Icon=$HOME/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png
Terminal=false
StartupNotify=true
MimeType=text/x-python;
Take care with the Python version. in $HOME/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png change python3.8 if needed
Step 2. Copy your Anaconda.desktop to /usr/share/applications/ as root (Because you might need permission to copy at /usr/share/applications/)
sudo cp Anaconda.desktop /usr/share/applications
This will create a desktop entry named Anaconda in /usr/share/applications/.
Step 3. add this line export PATH="$HOME/anaconda3/bin:$PATH" to your /etc/profile or $HOME/.bashrc
Step 4. Check if Anaconda is added to your application dock. If you didn't find it, search it in search-bar. Or you can run directly from /usr/share/applications/Anaconda.desktop.

Docker: Mount volume from Windows host

I use 1.12 version of Docker on Windows, since I can't use the Hyper-V feature with the newer "native" version - so I have my quickstart terminal and communicate to docker host via the invisible underlying virtual box.
Now I have the problem, that I need to mount a local folder to a container, which worked successfully from within the docker-machine by adding
--volume="`pwd`:/root/data"
to the docker run command, but it does not when I launch the same command from my Windows quickstart terminal (even though pwd command works correctly in the terminal).
I tried to find the Windows specific settings for the directory and tested several combinations of format, but no luck. Can anyone help me out on how to correctly specify a Windows folder (e.g. C:\Users\alexander.ruehl) for the volume parameter?
You can use relative path for your volume : --volume="./mydata:/root/data"
Also make sure that you have given the permission for read/write to Docker.

Is it possible to navigate to a parent directory in the jupyter tree?

Normally, I launch jupyter from a new bash terminal:
~$ jupyter notebook
and then navigate down the tree to the files I want to work at.
I just did it from a terminal that was already running at a different path:
~/blah/blah/blah$ jupyter notebook
and realized that that directory becomes the home for jupyter. I wanted to work at a file located at, say ~/blah/thingy/luis.ipynb, but couldn't find my way up.
How do I navigate the directory tree upwards in jupyter notebook?
As explained in https://github.com/ipython/ipython/issues/7751, it is not possible to navigate to the parent directory for security reasons:
The kernel might not be python, nor on the same machine than the
server, nor do you need a running kernel to use server API(s).
If you want, you can ask for more information in the aforementioned GitHub issue.
As edwinksl pointed out it is not possible for security reasons. See https://github.com/jupyter/notebook/issues/2032.
But if you want to keep your luis.ipynb file in its original location and still be able to access it from Jupyter Notebook browser, you can create a symlink to it in your running Jupyter Notebook directory:
ln -s ~/blah/thingy/luis.ipynb ~/blah/blah/blah/
For more details on symlinks see https://www.howtogeek.com/297721/how-to-create-and-use-symbolic-links-aka-symlinks-on-a-mac/

Resources