Fish can't execute anything on my machine without python3 - fish

I have an issue with my fish shell when using pyenv with Python2 activated:
$ pyenv shell 2.7.14
$ ls
pyenv: python3: command not found
The `python3' command exists in these Python versions:
3.6.4
It seems like even when I execute a command as simple as ls / cat / etc, something is calling Python 3. I never get a similar issue without pyenv removing access to Python 3.
How can I find out what is calling Python 3? I've tried clearing my config.fish file, but this problem still occurs

This might be triggered by autocompletion. From the README section on optional dependencies:
automated completion generation from manual pages requires Python 3.5+
the fish_config web configuration tool requires Python 3.5+ and a web browser

Related

Can't import plotly in Notebook in Visual Studio Code

I'm trying to create graphs using plotly for the first time. Since I'm currently using Visual Studio Code for my coding (either python scripts or notebooks), I'm currently trying to use plotly in VSC.
I've installed everything from the plotly getting started page (conda installed plotly, notebook, ipywidgets and even jupyter) but I'm still getiing an error when importing.
The thing is, when I've tried importing plotly in a python file in VSC, it's running well. I've also tried running it in a Jupyter Notebook and it's also running.
import plotly.express as px
I'm pretty sure that I've installed everything in the correct environment and I'm using the same environment all throughout.
What do I need to run plotly in a notebook in VSC?
It seems like your python versions/pip versions are different (especially if you're using an env). In Visual studio Code, you can bring up a simple terminal directing to the directory of your project (or env). Just click Terminal > New terminal. This will bring up a terminal (like CMD or terminal) at the bottom of the screen.
From then you can check the version of Pip and python for either your system globally, or the version install in your env. As long as your env is activated, then it will check the versions for the env, not your system.
For macOS:
To show all python installations of your system:
which -a python
To get the version for python 3 (which is what you should be on):
python3 --version
To get the version for pip:
pip -v
For windows:
python3 --version
pip -v
If the versions are incorrect then you can either install the right version of pip in your env or change python paths. First option is recommended.
If you are using macOS. Entering the command which -a python will show a very old Python 2.X version. Do not tamper with this or it's path as it is needed by macOS to run.

powershell and conda: conda activate env returns command not found

I have pip installed powerline-shell in my base conda env. Switching envs yields the following error:
conda activate <env_name>
-bash: powerline-shell: command not found
I also tried running conda init powershell but it took no actions.
I have miniconda3, with conda 4.7, installed on MacOS Mojave.
I don't know a simple solution to this. I'm thinking you either need to install it in every env (which I don't recommend because it's best to avoid using pip in Conda) or you create a link to the powerline-shell binary in another location that you can keep on PATH to avoid adding the entire miniconda3/bin/ directory to PATH. I've done something like this in the past, but never with a Python entry point before.
I'd try something like
mkdir -p ~/.local/bin
ln -s /your/path/to/miniconda3/bin/powerline-shell ~/.local/bin/powerline-shell
Then add .local/bin to PATH in your .bashrc, probably toward the beginning (e.g., before the Conda section). The path here (~/.local/bin) is totally arbitrary, so adjust to your preferences. Main point is to minimize what you are exposing globally in a shell session.
Note: conda init powershell is for Windows PowerShell users.

Using conda environment in IPython interactive shell

I am trying to use the interactive shell of IPython within my conda env and am having issues.
The steps I take are:
source activate myenv
conda install ipython
ipython
When I am in ipython interactive shell, it calls python from the anaconda root bin. (~/anaconda2/bin')
Is there anything I can do to change the python path to ~/anaconda2/envs/myenv/bin and import packages from myenv?
I see few solutions to making env work in jupyter when I search the web, but no answer on making it work on the interactive shell.
This is likely due to your $PATH variable being messed up.
THe easiest way to make sure you get IPython from within an env is to use $ python -m IPython <rest of the options> to start IPython. This works for many of the Python installable application; like pytest, pip and other.

ipython will not work even after reinstalling

Im trying very hard to get ipython notebook to work. I got it working in terminal, but I can't get it to work in my browser.
When I type ipython notebook in terminal, it says -bash: ipython: command not found
MacBook-Air:~ me$ sudo easy_install https://github.com/ipython/ipython/tarball/master
Downloading https://github.com/ipython/ipython/tarball/master
error: None
MacBook-Air:~ me$ ipython
-bash: ipython: command not found
Im really unsure why this is happening.
You do not need to (and you probably shouldn't) do sudo easy_install it will probably install things as root, avoid sudo. Check that ipython executable is in your $PATH.
github tarballs are broken for IPython. You do have to deep clone with git if you want to run master, then run python setup.py with the option you like (install, develop, symlink)...
Use pip if you want to run IPython stable.
You might have issues with readline on osx (wrong multiline editting, wrong completion, IPython popping error messages at launch time) this is one of the rare case where you might have to using easy_install for readline.
Maverick (10.9) has issues with python/numpy/matplotlib you might need to have a custom python build with homebrew that does not use system libs.

Unable to start ipython with .pythonrc using virtualenv

I want to be able to start an ipython session with it importing some modules. On Windows this would be simple - I had a global installation of ipython and I used .pythonrc I think it was.
However, in Ubuntu 13 I have ipython installed in a virtualenv (but not installed globally).
In my .bashrc is:
alias ipy="python -c 'import IPython; IPython.terminal.ipapp.launch_new_instance()'"
I am wondering if it's possible to run similar startup commands in ipython. Or if that's not possible with my current setup - then what is the best way to achieve what I want in Ubuntu.
Hopefully some combination of PYTHONSTARTUP or IPYTHONDIR environment variables in your .bashrc can accomplish what you want.