I have installed anaconda on C:\Users\My_name\AppData\Local\Continuum\Anaconda2, the issue is that whenever I launch jupyternotebook or any other from the anaconda navigator the starting directory is a external network location Z:. I want jupyter to be installed and run on C:\ how do I solve it?
Here is a copy of the anaconda command prompt so you better understand what I mean.
I have already reinstalled anaconda making sure that I select the C:\ directory, even installing offline so the computer has no acces to Z:, but the result is the same. Any ideas on how to solve it?
I defined a new windows PATH variable to ~\Anaconda2\Scripts. Then I can start jupyter notebook anywhere just by tiping "jupyter notebook" on the command line.
For MacOS, edit this file:
/Users/{your user name}/anaconda/bin/jupyter_mac.command
Original was:
DIR=$(dirname $0)<br/>
$DIR/jupyter-notebook
I added a line:
DIR=$(dirname $0)<br/>
cd /Users/{your user name}/{whatever folder you want}/<br/>
$DIR/jupyter-notebook
This way, Jupyter notebook starts directory you want. Be careful about folder names with space. Use \ before the space. For example, the Google Drive folder shoule be:
cd /Users/{your user name}/Google\ Drive/
Related
I have Git for Windows and want to be able to start Jupyter Notebook in a directory of choosing using File Explorer. If I right click in a directory and select "Git Bash Here," a Bash shell opens. I already added my Anaconda directory (where my Python 3.7 is located) into the user path, and I can verify that Bash sees that in the path by "env|grep PATH". However, when I type "jupyter notebook" from the Bash prompt, it finds the script and it starts to run, but reports an "ImportError: DLL load failed: The specified module could not be found."
How do I set the Bash environment to start a Jupyter Notebook from the current directory where I have a Bash prompt?
I solve this problem with the command:
source "C:\Users\...\Anaconda3\Scripts\activate"
When you install Jupyter via anaconda it isn't added to the system's enviornment variables. Your system doesn't know about Jupyter. Only anaconda does because it is managing your packages and your versions for each project you create.
If you're using bash for windows I would think you'd have to install Jupyter notebooks to windows and add it to your environment variables to be able to see it in any directory.
Edit: Here's a picture of me running Jupyter from my windows command line and from the Anaconda prompt.
In your GitBash prompt type the following command
. Anaconda3/Scripts/activate
assuming you are in your home directory.
This will allow you to run jupyter from GitBash and also use UNIX commands from jupyter.
I installed Anaconda on my Windows 10 machine.
I have a few Jupyter notebooks on my pc and I would like to associate them with Jupyter, so they can be opened by double-clicking on the file, to avoid having to open Jupyter and navigate to the notebooks folders each time. Is this possible?
All notebooks should open in the same Jupiter Kernel (same localhost in the browser address bar), without starting a new kernel for every file I click.
PS I asked here because I figured this question to be more of interest for programmers, but if you think it would be more suited for SuperUser, I'll flag it for migration.
Install nbopen: https://github.com/takluyver/nbopen
pip install nbopen
python -m nbopen.install_win
Now you can double-click on *.ipynb files:
If you have Jupyter installed with Anaconda you can do the following.
Create a little batch file (e.g. start_jupyter_notebook.bat) with the content (the commands are from the Jupyter shortcut):
#echo off
set ANACONDAPATH=C:\_work\_programs\Anaconda3
%ANACONDAPATH%\python.exe %ANACONDAPATH%\cwp.py %ANACONDAPATH%^
%ANACONDAPATH%\python.exe %ANACONDAPATH%\Scripts\jupyter-notebook-script.py %1
(of course you will have to change the ANACONDAPATH to your installation)
Then go to one .ipynb file of your choice, right-click on it, go to properties --> open with --> change and select your created batch file.
I am pretty sure this can also be setup for any other Python/Jupyter installation.
P.S. The cwp.py file sets up some environment variables. I guess this is the reason why fredm73's answer did not work for everybody. Apart from that my answer is quite similar in the end.
associate .ipnyb with jupyter-notebook.exe
On Windows 10: control panel/Programs/Default Programs/Associate a file type or protocol with a program/Choose default apps by file type
Look at the list of extensions, find '.ipnyb'. Click on icon and locate the jupyter notebook program. In my Anaconda installation, it is found at
anaconda/scripts/jupyter-notebook.exe
Easiest way for me - double click on the .ipnyb file. When prompted to pick a program to open the extension with go to /ProgramData/Anaconda3/Scripts and locate the jupyter-notebook.exe file and click it.
NOTE - to access the ProgramData folder you will need to view hidden folders in the Windows explorer or access it by typing %programdata% in the navigation line:
You can use nbopen on pip and run the module:
py -m pip install -U nbopen
py -m nbopen.install_win
For those who installed nbopen in Anaconda but it does not work:
Use Regedit to search for a directory called Jupyter.nbopen, and navigate to its shell\open\command. It should be something like:
HKEY_USERS\****\Software\Classes\Jupyter.nbopen\shell\open\command
Then, change the default to: (Modify the path if you are not installed in default location)
"C:\ProgramData\Anaconda3\pythonw.exe" "C:\ProgramData\Anaconda3\cwp.py" "C:\ProgramData\Anaconda3" "C:\ProgramData\Anaconda3\pythonw.exe" -m nbopen "%1"
The reason behind this is that cwp.py makes sure that the Jupyter is running in Anaconda instead of other Python environments.
Then it should work, although it will activate two invisible pythonw process running in the background.
Just look into your file directory and look for programs that can open the file type and set it as your default app opener but you need to take into consideration that if you want to use Jupiter notebook, you can run jupyternotebook app and locate the file from the jupyter notebook directory.
Secondly, ensure you have added your python.eex to path and run directly from your command prompt. See pictures in the screenshot
Find the jupter-notebook.exe in the C:\Users\my_username\Anaconda3\Scripts folder. Copy the address. When you're opening the .ipnyb file double click ( if first time) or just do open with and there in the menu you can tick the 'always use this' option and locate the notebook from 'look more programs' option in the menu.
I used to be able to change the default start up folder for Jupyter (the folder Jupyter displays in browser when it was first started) by modifying the "start in" option of the Notebook launch icon's properties on Windows, as described here and here.
However, this is not working any more after I recently installed Anaconda 3. Even though I changed the "start in" folder to the folder I wish, the browser still goes to "Documents" folder by default. I tried doing this as admin, still didn't work. Any suggestions? Thanks!
Although a permanent fix is still not found, I do have the following workaround that works great!
Using the way described here, change the start up dir for Anaconda prompt, then launch it and make sure the default folder is the one you want, and type "jupyter notebook". There! The notebook should launch in your desired folder.
UPDATE:
You can also directly launch Anaconda Prompt, then use cd C:\Users\Name\Folder to navigate into the folder where your iPython notebook files are located, and then use jupyter notebook or jupyter notebook myfile.ipynb to start working!
The only thing that worked for me to permanently fix the default working directory is by using this comment by MrFancypants.
In your default directory (documents), there is a hidden folder /.jupyter and within it a config python file.
you can edit it and change the line
## The directory to use for notebooks and kernels.
#c.NotebookApp.notebook_dir = ''
to
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'ENTER_PATH_HERE'
where you should put your favorite path instead of 'ENTER_PATH_HERE.
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/
I am just getting started trying to learn Python for course assignments. Our teacher has mandated using iPython notebooks, so I have installed Enthought Python AND ipython on my Mac.
The iPython home directory is /users/me/.ipython
I have used the ipython profile create command to create the file
.ipython/profile_default/ipython_config.py
but I don't know how to access this file or what to put in it.
My objective is to set the default file path to:
/users/me/documents/classes/analytics/hw1
so that code in my ipython notebook will automatically know where to look for data files.
Please help!
You can change the default path to your notebook files. Search in ipython_notebook_config.py for a setting notebook_dir.
The default folder for accessing files is the folder that your notebook is in. If you need to change that, then at the start of the notebook, add a command like this:
%cd /users/me/documents/classes/analytics/hw1