How to open a Jupyter notebook on a Mac? - macos

Maybe this does not work at all, because its a Mac, but maybe there is a way to open a jupyter notebook on a Mac? I tried the following command
jupyter notebook Manager.ipynb
and I got an error
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory. Same with out 'notebook':
jupyter Manager.ipynb
Error executing Jupyter command 'Manager.ipynb': [Errno 2] No such file or directory
There is a file named Manager.ipynb in the current folder.
So is there a way to open that notebook on a Mac? Do I have to install some crazy stuff in order to make it work?

The problem I was facing was either a mis-installation of jupyter, or there is another application on Macs with the same name. However, (re)install it with this command
pip install --user jupyter
(a global pip install does not seem to work because of some Mac-nonsense, see here), and then it might work. Or install it in a virtual environment altogether.

This may or may not be helpful for you, but it's something to know and it's how I access the notebook on my mac.
When I installed Julia, it just came with the command line, I never got the icon to open the notebook or anything of that nature. I had too much trouble trying to install it so I just gave up on getting the icon or a direct link, but if you get Julia installed, you should be able to access the terminal version by entering
$ Julia
Or clicking on the Julia terminal icon, which will give you this:
And then you can just open the notebook by running the following:
using IJulia
IJulia.notebook()
Also if you're just starting with Julia don't forget you may have to add the package manager by typing using Pkg or adding it directly to your code.
This should open it in your default browser (there is no option to open it in a different browser or window). I'm not sure if this is useful but it's an option for those who have trouble installing it like I did.

Related

jupyterlab looping in safari

After I pip install jupyterlab, I can't open it since it gets stuck in an infinite loop in safari!. I want to change my browser to chrome and tried to do it through a solution offered here but I can not find the #c.NotebookApp.browser = '' to change it.
Do you have any suggestion on how to solve this weird infinite problem in safari?
I finally realized that the best work around this is to install a virtual environment and run jupyter lab there,
Simply run the followings:
1- pipenv install jupyterlab
2- pipenv shell
3- jupyter lab

Anaconda prompt not displaying (base) environment, displays path instead

I just did a more or less clean install of Miniconda3-latest-Windows-x86_64.exe. I selected the "All users" option to avoid admin rights problems with packages such as jupyter. The program was installed into C:\ProgramData\Anaconda3.
When I open the Anaconda prompt, conda returns the following output, however it doesn't recognize the base environment the way I would like it to, instead I get this on my prompt:
(C:\ProgramData\Anaconda3) C:\Users\aboufira>
When I really expect this:
(base) C:\Users\aboufira>
I find this problem to be quite annoying. Why does this occur? Have I installed into the wrong directory? How can I get it to display base like it should?
Delete your .condarc-file located at C:/Users/User and restart navigator again - worked for me :)

Launching JupyterQ from Anaconda Navigator

I'm following Kx instructions on installing jupyterq, embedpy and kdb in Anaconda. This is where I want to get to - a Jupyter notebook where I enter q commands. However, when I launch Jupyter notebook from Anaconda Navigator, I'm only able to create a new Python 3 notebook.
How do I create a notebook which accepts q commands?
Checked so far:
I can launch q from ubuntu terminal, it's licensed
In Anaconda Navigator, base environment shows jupyterq, embedpy and kdb as installed
I see jupyterq_kernel.q and others in my ~/anaconda/q directory
EDIT: Meanwhile, I downloaded Jupyter kernel for kdb+ manually. Its install.sh apparently registered q kernel for Jupyter. I'm able to open a notebook with jupyter notebook from terminal.
The below is now redundant as the Conda package has been fixed, but is left for reference
You can follow the guide here http://www.enlistq.com/installing-kdb-jupyterq-and-embedpy-using-conda/ in order to add the kernel to Jupyter, it seems the package misses kernel.json
From the comments it appears this is or will be fixed, but given you've already installed everything, it is likely quicker to follow the relevant section of this tutorial (under "installing jupyterq")

Can't get pip working with psychopy install

I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.

Non-root jupyter notebook startup

I recently got a new Macbook Pro (Sierra 10.12.3) and wanted to install anaconda. I downloaded the graphical installer from the conda website and ran it; I mistakenly selected the option to install in root (ie not just for a local user). The installation went fine and python ran without a hitch. However, when running jupyter notebook I was told "Permission denied". sudo jupyter notebook worked.
Previously, I had been running an up-to-date conda and jupyter notebook on my previous laptop with Yosemite, and I had never had to sudo to run the notebook. As far as I've been told, letting programs (even trustworthy ones) run with root access should be avoided at all costs, so I wanted to try to fix this.
I used anaconda-clean and then removed the conda directory, and re-installed it for the local user (so now it sits in ~/anaconda/ and not //anaconda/). All conda commands now work without sudo except the jupyter notebook, which still requires sudo jupyter notebook or else it throws the same "Permission denied" error.
How do I solve this and enable the jupyter notebook to start up without root access? I do not know if this is a related issue, but the notebook starts up in Safari despite my default system browser being set to Chrome. Any help will be appreciated!
Got it working; the key is in the ownership of the ~/Library/Jupyter folder. As mentioned in the comments, the anaconda-clean utility deletes all the config files in the home/root folder, and then the removal of anaconda involves "simply" deleting the //anaconda or ~/anaconda folders depending on which install was done.
However, it appears that the Jupyter Notebook creates the ~/Library/Jupyter folder in the home directory, which I obviously missed! Recursive chown does the trick.
Incidentally, this also solves the browser problem, and the notebook starts up in Chrome as expected. I suspect this may have had something to do with sudo jupyter notebook starting up its own browser as root.

Resources