I'm using the fantastic SageMath Cloud service to remotely collaborate with a partner. In particular, I'm using IPython notebooks. Unfortunately, the language seems to default to Python 2; I would prefer Python 3.
SSH'ing into my project, I can see that IPython 3 is actually installed. Is there a way to coerce SMC into using Python 3 for notebooks?
I have tried the instructions mentioned in the FAQ, i.e.,
ln -s /usr/bin/python3 ~/bin/python
ln -s /usr/bin/ipython3 ~/bin/ipython
While this works for invoking Python from the SSH commandline, it doesn't seem to affect the kernel used by IPython notebooks created from the web GUI.
Once you open an IPython Notebook on SageMathCloud you can switch the kernel to a variety of choices, including Python 3. To do that, use the 'Kernel' menu, then 'Change kernel', then 'Python 3'.
Switching to the Python 3 kernel in the IPython Notebook on SageMathCloud is discussed in this discussion the sage-cloud mailing list.
Is this what your question is about, or are you asking how to make that choice the default when you open a new IPython Notebook on SageMathCloud?
To get the fastest answers to SageMathCloud questions, use the sage-cloud mailing list.
Related
I'm using wsl and it runs codes in vscode pretty fine and I have different libraries which I installed through pip and conda in wsl but when I run that code using vscode itself it doesn't recognize the libraries or even pip itself.
I don't have any other environment.
I should add that I installed the packages globally using conda install ... or pip install ... in base environment and I only have base environment and I run my code through code . and I also have python and remote wsl extensions installed in my vscode.
what can be the problem?
I don't have much personal experience with this, but I found some useful information in this Stack Overflow question (even though it doesn't utilize conda), along with https://code.visualstudio.com/docs/remote/wsl-tutorial#_python-development.
I also found this blog post useful, even if it doesn't cover WSL.
In short, make sure you:
Have installed the Python extension (by Microsoft) in VSCode. This is critical for being able to detect and select the Python interpreter. You don't mention having this in place, so I believe this is your likely problem.
You have done this already, but including it for others who might read this later -- Install the Remote - WSL extension (or the Remote Development extension pack) in VSCode.
You are also doing this already -- Start VSCode from inside your WSL distribution. Alternatively, you can start VSCode from Windows and then select the Remote WSL - Reopen Folder in WSL from the Command Palette (also accessible from the "Remote" Status Bar).
In VSCode, open the Command Palette with Shift+Ctrl+P, search for the Python: Select Interpreter command, and you should find your Conda environment in the list.
After selecting this, you should find that your project is using the interpreter and modules that you have installed via conda.
One thing I did to overcome this issue is go to Extensions -> Local (You should have two tabs there, Local and WSL:DISTRO) DISTRO refers to whatever DISTRO you're using, you will see that some of the local extensions are disabled in the current workspace (WSL) and there is a little cloud icon in the WSL:DISTRO tab that says install Local Extensions in WSL:DISTRO once you click that it will let you choose which extensions to install and you should be good to go!
I apologize if it is a trivial question, but I searched and I could not find the answer. My situation is the following:
I have access to a server through ssh tunnelling. The server has Julia installed but not jupyter.
My machine has both, and my code is mostly in jupyter notebooks and I wish to keep it that way.
I wish to be able to run my code on a julia kernel on the server, but editing from a Jupyter interface/ IJulia locally.
I have found several guides on how to launch jupyter from remote, but they do not apply since the server does not have jupyter installed. Similarly, I am aware I could convert my code in a julia script and run it, but I would rather keep the convenience of a notebook for editing.
Is this even possible to do?
Any help is very appreciated!
I am using vscode with the Python extension and Jupyter extension. For the Python extension, I have several interpreters available, installed by anaconda directly or different virtual environments I have created using conda. Thus, with the Python extension I can run code using different Python versions and packages. However, only one kernel is available for running the jupyter notebooks within vscode:
C:\ProgramData\Anaconda3\python.exe -m ipykernel_launcher
The "jupyter mode" in vscode does not recognize packages I have installed in my virtual environments. Is there a way to start the Python kernel for "jupyter mode" from one of my virtual environments? Or is there another way to solve this problem so that I can use a specific virtual environment in "jupyter mode" within vscode?
Thanks for all help.
The solution was to install the ipykernel for the different conda environments following instructions such as these. These kernels are then automatically identified by vscode.
I had started with udacity deep learning course and was setting up environments. I think the kernel notebook uses does not use python from conda environment. Following are some of the results of things I have tried.
Started conda environment
source activate tensorflow
With python terminal inside conda environment from linux terminal:
import sys
sys.executable
>>> '/home/username/anaconda2/envs/tensorflow/bin/python'
Also tensorflow gets imported with python shell
With ipython terminal inside conda environment, it shows same executable path. and tensorflow gets imported inside ipython shell.
However with jupyter notebook when I execute a cell in notebook, tensorflow module cannot be found. Also terminal spawned from notebook shows executable path of global python installation which is in anaconda/bin directoty, not of environment I had created from which I started the notebook
'/home/username/anaconda2/bin/python'
However conda environment of shell is still tensorflow
conda info --envs
# conda environments:
#
tensorflow * /home/username/anaconda2/envs/tensorflow
root /home/username/anaconda2
Does that mean kernel is linked to python installation in this location and not in conda env? How to link the same?
There is some more nuance to this question that is good to clarify. Each notebook is bound to a particular kernel. With the latest 4.0 release of Anaconda we (Continuum) have bundled a Conda-environment-aware extension that will try to associate a Notebook with a particular Conda environment. If that cannot be found then the "default" environment (or "root" environment) will be used. In your case you have a Notebook that is, I am guessing, asking for the default (or "root") environment, and so Jupyter starts a kernel in that environment, and not in the environment from which the Jupyter server was started. You can change the associated kernel by going to the Kernel->Change kernel menu and picking your tensorflow environment's kernel, along the lines of this:
Or when you create a new Notebook you can pick at that time which Conda environment's kernel should back the Notebook (note that one Conda environment can have multiple kernels available, e.g. Python and R):
We appreciate that this can be a common cause of confusion, especially when sharing notebooks, since the person who shared it either used the "default" kernel (probably called just "Python"), or they were using a Conda environment with a different name. We are working on ways to make this smoother and less confusing, but if you have suggestions for expected/desired behavior, please let us know (GitHub issue to https://github.com/ContinuumIO/anaconda-issues/issues/new is the best way to do this)
I have IPython and IPython Notbook installed and am working my way through the IHaskell installation instructions. I have all the IHaskell prerequisites installed, but before I commit to the final step of installing IHaskell itself with
cabal install ihaskell --reorder-goals
I want to confirm one — perhaps obvious — thing: Will I still be able to use Python Notebooks? The instructions following the step above seem to say that simply entering
ipython notebook
will run Haskell rather than Python, as if Haskell has replaced Python in IPython Notebooks. Is this the case? How do I specify whether I want to run Haskell or Python in a notebook, or in IPython itself for that matter? Can I switch freely between the two?
OS X 10.10.4; Xcode 6.4; CLT: 6.4.0.0.1; Clang: 6.1; Haskell Platform 7.10.2-a. Python 2.7.10 (Homebrew). Using Homebrew in general, but, following what appears to be Homebrew's recommendation, not for Haskell.
Like other kernels, IHaskell can be added to IPython/Jupyter without interfering with other kernels. Once added Notebooks will recognize the language used in (suitably tagged) notebooks and will add an entry to the 'New' notebook menu that allows selection of the language to be used for new notebooks.
Each kernel will have its own command for adding itself to IPython/Jupyter. For IHaskell this is simply
ihaskell install