Running a pip-installed Spyder in virtual environment on Ubuntu without Anaconda? - python

I just recently started learning Ubuntu (17.04) and have managed to figure out how get plain Python3.5 + Spyder3 running, have created a virtual environment, and gotten the v-env running with Spyder by changing the interpreter setting within Spyder via pointing it to the virtual environment bin.
However, I saw numerous other ways of installing Spyder, primarily via a pip3 install in the environment itself, but I found nothing as to how to actually RUN the pip-installed Spyder. Running "Spyder3" always runs the default install regardless of location.
Does anyone know how to actually run it?
I was curious because I figured it would allow for a similar functionality that Anaconda provides where you can simply select your virtual environment and run the respective Spyder version for it.

I figured out the issue. Seems that I was somehow running it from the wrong location, just had to run Spyder3 from the v-env bin folder.

Related

Ubuntu - How to remove Pyenv completely including virtual environments

I created a Python project inside WSL Ubuntu OS which I created on my Windows 11 machine and thought of using Pyenv for managing various Python versions, but I was kind of confused and hence thought of uninstalling it using "pyenv uninstall" and removing all the entries of pyenv from ".bashrc" in my Ubuntu OS. I don't think it is removed completely since I still see a .pyenv folder in my home directory.Whenever i try to delete it, i get an error pop saying that it is already deleted, but the thing is that it still shows up.When i try to verify pyenv, i get below error messages. The only thing i want is to get rid of all this pyenv file from my OS so that i can create a new virtual environment and use normal pip commands for installing python and other libraries instead of this pyenv.

PyCharm doesn't recognize packages installed via Terminal when environment is used in PyCharm in Pop_OS Linux

I'm using Pop_OS! Linux. Whenever I make a Python Virtual Environment using mkvirtualenv and then pip install packages into it, that environment does not work when I reference it inside pycharm. I set up virtual environments using virtualenv and virtualenvwrapper.
The workaround I've found is to build any virtual environment you need to use inside of PyCharm inside of pycharm, or using the terminal inside of PyCharm. I'm annoyed it doesn't seem compatible with my native terminal, and can't figure out why. I even get slightly different python versions by running python --version both inside the PyCharm terminal and in the native linux terminal, while inside the same virtual environment! It's like Pycharm isn't reading the same information out of the python environment directory as my terminal is.
What is going on here, and how do I harmonize PyCharm with the rest of my linux machine? I'm also new to Pop_OS! Trying it out for the first time is an adventure.
IDK if that will work, but maybe if you install your packages via the "Python packages" tab in PyCharm (down left -> add package next to the research bar that appeared), PyCharm will see them while it installed them itself.

iPython console in Spyder does not enter in debug

I removed and started with a fresh new installation of Anaconda.
Just after installation I created a custom environment (cust_env)
Both the cust_env and the base environment have Python 3.9.
I then installed on both environments Spyder 5.1.
Now, the problem is the following:
If I run Spyder from the base environment, it seems to work and debug my code normally, while if I run it from the cust_env, when I enter in debug mode the console apparently does not answer anymore (the debug prompt does not appear and you must restart the kernel to have it back again).
I also tryed with different versions of Python (3.7.x and 3.8.x) and of Spyder (4.x, 3.x) and the behaviour looks identical.
I cannot understand what might be the difference which does not allow to use Spyder in an environment different to the base one.
I was able to delimit the problem and find a workaround.
The base problem is that, when you create a new environment of Anaconda, since it contains very few packages (Python and few more), when you afterwards install a new package, it is fully updated with all its dependancies.
In particular
conda install spyder
installs Spyder and all its dependancies at the very last available version.
On the opposite side, the base environment of Anaconda already contains plenty of packages and conda does it best to install the most updated version which is still compatible with the existing packages, but very often it is not the last one.
Now, it appears that Spyder uses QT to show the graphical interface and one of its dependancies qtconsole=5.2.2 has some bug which causes the problem.
When installing Spyder from the base environment, conda installs qtconsole=5.1.1 and the problem does not appear while, if installing from a fresh new environment, qtconsole=5.2.2 is installed and the problem shows up.
Therefore, is is sufficient to downgrade qtconsole
conda install qtconsole=5.1.1
to fix the problem.

How can I switch virtual environments with Spyder without going to preferences?

I have been programming in Python using Spyder in combination with virtual environments for a while now. Before I started using virtual envs, I installed Spyder using pip. I am not very familiar with paths and environments, but this seemed the way to go when I repetitively ran into package compatibility issues. However, it has been bugging me that every time I want to switch environment, I need to change the working directory to the folder of the environment and I need to change the Python interpreter manually within Spyder.
When I was looking for a solution, I found that it is possible to install Spyder within a virtual environment. I did this and found out that opening Spyder from a virtual environment has the exact same working directory and interpreter as the standalone version (the one I started with). This means that I still have to change the interpreter and working directory manually... Am I doing something wrong or is the only way to switch environments by changing it in the preferences tab within Spyder?
Background info: Using Windows, Spyder 4.2.1, venv as described on https://docs.python.org/3/tutorial/venv.html

PIP command doesn't work inside virtual environment

The interpreter I use is
and it works in virtual environment. I have both anaconda and python interpreter installed in my system
But if I want to install something using pip for instance "Flask" then it happens
I am using Linux Mint 18.1 Serena"
And the way I tried to create the virtual environment is
Lastly there is no space in the directories where I tried to create virtual environment
Then I tried this link
Specifically the following commands
All those things didn't solve my problem and lastly I ended with the following errors each time I open my shell
Then I change my source of bashrc & bashrc-org to
virtualenv
export WORKON_HOME=~/virtualenvs
source /home/cryptosilicon/anaconda3/bin/python
Now get the following error
How do I correct the error and make the pip work inside virtual environment ?
I just solved (or at least found a work-around) for a similar problem.
I am using Linux Mint 18 and python 3.
I was trying to install a dependency inside a Python virtual environment using pip and it would fail (and actually pretty much mess up my whole virtual env).
The message was : "bad interpreter: No such file or directory".
But I noticed that the referenced path was actually truncated at the first space.
So I tested an virtual env in a folder for which path there is no space and it worked.

Categories