You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There just doesn't appear to be an obvious way to tell op-ipython to use the ipython installed in a virtualenv. This is necessary if a project is using virtualenv so that all of its installed libraries can be accessed (including the project code base itself).
Is it possible to tweak the PATH that ob-ipython uses to launch ipython? Perhaps I'm missing something obvious?
I was about to file the same issue. There are two issues I can't work out that would be really make this a true EIN alternative.
virtualenv support
It would be fantastic if the RPC ipython session was capable of utilizing the pyenv-workon much like elpy does with it's virtualenv support. After activating the workon env for such a setup, trying to run the ob-ipython code block fails to recognize the virutalenv and only runs the systemwide python installation.
tramp
I put this more in the I am probably not understaning what I am doing category. When I pass a remote directory (computational machine directory) to the org-babel source block with :dir /ssh:remote.machine.edu:/research/data/directory, I am able to see the stuff in that remote folder, but then I am unable to use any of that remote machines virutalenv pacakges to do the analysis I'd like to do.
I know elpy doesn't support tramp because it does a lot of confusing things, but that is why I use the org babel python blocks to execute remote code after I develop the code with the elpy interface in my local virtualenv.
EIN is able to avoid this virtualenv problem if I configure the notebook server to luanch in the virutalenv and then remotely do the EIN stuff there. However, I am in your camp that org-mode has many advantages over markdown.
candy and nuts workflow
What I would like to be able to do with this is first use the pyenv-workon and select the virtualenv I will use for the analysis. Then using the ipython ob-ipython block, use the functionality with ipython within the code block. As org-babel is able to use tramp to use remote directories already, it would be great if virutalenv support could be worked into this (either locally if that is the only place ipytnhon can work with this package or even better in the remote directory with a remote ipython session).
Please let me know if this isn't clear. Here is a simple example of where things go wrong.
#+BEGIN_SRC ipython :session analysis :dir /ssh:research.manchine.edu:/home/reconmaster/data/160324_a_lot_of_data_and_results :exports both :file ./analysis.png
import matplotlib.pyplot as plt
import numpy as np
from skimage import io
# custom image analysis package I wrote and installed in the research virtualenv
import imanal.display as disp
#+END_SRC
I've noticed the remote issue has been mentioned #39 and #11. If such support could be addressed, the virtualenv problem could be resolved by connecting an ipython server launched in the desired virtualenv.
I've never used virtualenv. How does it work? Is pointing ob-ipython at a different python enough? ob-ipython uses the same mechanism to choose a python install that the builtin mode uses:
I want to split this issue up as you have multiple concerns going on here. Let's talk about how to select a python install here. I'll create a new issue for tramp/remote support.
@gregsexton Yes, think that might work. For example I can launch a virtualenv python interpreter directly from its path like so ~/.virtualenvs/my-virtual-env/bin/ipython and the path will be set correctly. So python-shell-interpreter may do the trick. I'll try to test it later.
Yeah, I'm tempted to agree. Support for choosing a python install is already available. Maybe there should be some docs for this though as it seems to come up semi-frequently...
Activity
gregsexton commentedon Mar 23, 2016
Can you give more detail? What's the problem? What does virtualenv do that causes a problem?
erikcw commentedon Mar 23, 2016
There just doesn't appear to be an obvious way to tell op-ipython to use the ipython installed in a virtualenv. This is necessary if a project is using virtualenv so that all of its installed libraries can be accessed (including the project code base itself).
Is it possible to tweak the PATH that ob-ipython uses to launch ipython? Perhaps I'm missing something obvious?
reconmaster commentedon Mar 24, 2016
I was about to file the same issue. There are two issues I can't work out that would be really make this a true EIN alternative.
virtualenv support
It would be fantastic if the RPC ipython session was capable of utilizing the pyenv-workon much like elpy does with it's virtualenv support. After activating the workon env for such a setup, trying to run the ob-ipython code block fails to recognize the virutalenv and only runs the systemwide python installation.
tramp
I put this more in the I am probably not understaning what I am doing category. When I pass a remote directory (computational machine directory) to the org-babel source block with :dir /ssh:remote.machine.edu:/research/data/directory, I am able to see the stuff in that remote folder, but then I am unable to use any of that remote machines virutalenv pacakges to do the analysis I'd like to do.
I know elpy doesn't support tramp because it does a lot of confusing things, but that is why I use the org babel python blocks to execute remote code after I develop the code with the elpy interface in my local virtualenv.
EIN is able to avoid this virtualenv problem if I configure the notebook server to luanch in the virutalenv and then remotely do the EIN stuff there. However, I am in your camp that org-mode has many advantages over markdown.
candy and nuts workflow
What I would like to be able to do with this is first use the pyenv-workon and select the virtualenv I will use for the analysis. Then using the ipython ob-ipython block, use the functionality with ipython within the code block. As org-babel is able to use tramp to use remote directories already, it would be great if virutalenv support could be worked into this (either locally if that is the only place ipytnhon can work with this package or even better in the remote directory with a remote ipython session).
Please let me know if this isn't clear. Here is a simple example of where things go wrong.
reconmaster commentedon Mar 24, 2016
I've noticed the remote issue has been mentioned #39 and #11. If such support could be addressed, the virtualenv problem could be resolved by connecting an ipython server launched in the desired virtualenv.
gregsexton commentedon Apr 24, 2016
I've never used virtualenv. How does it work? Is pointing ob-ipython at a different python enough? ob-ipython uses the same mechanism to choose a python install that the builtin mode uses:
(setq python-shell-interpreter "/usr/local/bin/python")
Does this help?
I want to split this issue up as you have multiple concerns going on here. Let's talk about how to select a python install here. I'll create a new issue for tramp/remote support.
erikcw commentedon May 5, 2016
@gregsexton Yes, think that might work. For example I can launch a virtualenv python interpreter directly from its path like so
~/.virtualenvs/my-virtual-env/bin/ipythonand the path will be set correctly. Sopython-shell-interpretermay do the trick. I'll try to test it later.joinvim commentedon Jul 9, 2016
Use https://github.com/proofit404/pyenv-mode and close this ticket.
gregsexton commentedon Jul 9, 2016
Yeah, I'm tempted to agree. Support for choosing a python install is already available. Maybe there should be some docs for this though as it seems to come up semi-frequently...
nanounanue commentedon Dec 26, 2017
Maybe related to #135