Sometimes I need to checkout a specific branch of a python package from github.
Branch is checked out and I run the standard python setup.py install from the directory of the package.
This installs fine. If I open a jupyter notebook (from anaconda prompt), then the package works as expected. But when I open Spyder (from anaconda navigator), the version of the package is from the anaconda installation.
How do I get my Spyder to recognize the branch in my github folder over the conda version? I think it is to do with python path system environment variables (?), but I never managed to get this set up properly.
N.B. This is on Windows 10.
Related
I successfully installed Yahoo finance in Anaconda
When I type
pip list
in the Anaconda Prompt, it shows that yahoo finance is there.
But when I try to import it on Spyder, I get the error:
"No module named 'yfinance"
Basically your error message it because Spyder isn't configured to work with conda's environment.
Check this link here and the possibles solutions from it:
Installing packages into the same environment as Spyder
Spyder is a Python package just like any other you may be used to, and so you can import any package within its Console or Editor as you could from a regular Python or IPython terminal launched in Spyder's environment:
If Spyder is installed with Anaconda (as we recommend) and launched
via a shortcut, from Anaconda Navigator or from Anaconda Prompt
without modifying anything, this will be the default base Anaconda
environment.
If Spyder is installed via pip (experts only) and not into a virtualenv/venv, this will usually be whatever Python installation pip itself belongs to.
If you use a system package manager (apt-get, dnf, emerge, etc) to install Spyder, this will typically be your system Python and its library of packages.
If you installed Spyder into a specific environment (conda-env or venv), or it came with a pre-configured one (like those for Keras or TensorFlow) and launched it from there, it will only have access to packages from that environment.
Therefore, if you'd like to use a package with your existing Spyder install (e.g. import'ing it into your scripts, packages or a Spyder IPython console), the simplest way to do so is to install the package into the same environment in which you installed Spyder, typically by the same means you installed Spyder (conda, pip, package manager, etc). However, if you're installing packages with pip, conda-forge, Github, or custom channels, working on multiple major projects at once, using prebuilt environments, or otherwise have more sophisticated needs, you'll likely want to use one or more separate environments for your packages. If so, the next section explains how.
I am getting an error while installing the package
pyramid-arima
I tried the following but could not resolve the issue
conda create -n pmdissue23 --yes --quiet python=3.5 numpy scipy
scikit-learn statsmodels
activate pmdissue23
pip install pyramid-arima
Output of above commands:
Requirement already satisfied: scipy>=0.9 in
/anaconda/envs/pmdissue23/lib/python3.5/site-packages (from pyramid-
arima)
Installing collected packages: Cython, pyramid-arima
changing mode of //anaconda/envs/pmdissue23/bin/cython to 755
changing mode of //anaconda/envs/pmdissue23/bin/cygdb to 755
changing mode of //anaconda/envs/pmdissue23/bin/cythonize to 755
Successfully installed Cython-0.28.1 pyramid-arima-0.6.2
Cleaning up...
But again the package is not installed correctly and pycharm asks me to download the package. This leads me to the following questions.
I am using Pycharm on windows 10 and having issues how pycharm is configured to use python. I installed python and Anaconda on my system prior to installation of Pycharm. I selected the interpreter as Anaconda when I created the first program.
Below are my questions:
Why is pycharm creating a new virtual environment for python interpreter instead of using the original installation. ( This causes me to import all the packages for each new project I create)
Should I use Anaconda or Python interpreter. I am not sure which one is the right one. Or should I have both.
I am having problems installing packages (pycharm gives me an error that my pip is not updated). However from my command line I updated the pip to the latest version. How do I connect pycharm to the latest pip.
Last question, How can I import all the data science packages to my python installation and point pycharm to read those packages instead of writing explicit import statements.
Any help would be greatly appreciated. Thanks
I reinstalled python on my machine. Updated the pip and other packages.
I am trying to use a Python virtual environment for the first time while trying to learn Django. I am using the instructions here. As I am using git bash on Windows, I am following the setup instructions for Windows.
I installed virtualenvwrapper using
pip3 install virtualenvwrapper-win
Now the command mkvirtualenv gets me bash: mkvirtualenv: command not found
I tried the solutions here to no avail.
pip3 list shows that the package is, in fact, installed, but there is no virtualenvwrapper (or virtualenv) .sh files in the site-packages directory, and the only related file I can find is virtualenvwrapper_win-1.2.5-py3.6.egg-info in an AppData/Roaming directory.
Any suggestions? Thanks.
I had the same problem and tried uninstalling virtualenvwrapper-win, just to see the list of files that would be removed. I saw that the mkvirtualenv was located in C:\Python\Python37\Scripts.
I noticed I was using the 64bit version of python (C:\Python\Python37\) alongside the 32bit one (C:\Python\Python37-32\), both folders being in the PATH of my system's properties. I removed the 32bit version's directories from the PATH and this seemed to work.
PS: I also noticed that running the commands from the MINGW terminal requires them to also have the .bat extension added:
I have installed Python 2.7, pip and virtualenv on my computer and I have created a virtual environment with this same version of Python. I installed some packages in this new virtual environment too.
Later, I decided to install Python 3.6 on the same computer to create a virtual environment that works with version 3.6. I downloaded Python 3.6 and installed it by selecting Add Python 3.6 to PATH and Install for All users and I selected the option to automatically install pip. As I had previously installed virtualenv, I have not had to reinstall it. Should I?
The problem is that, once installed, when creating a virtual environment I've got an error.
As I already had a version of Python installed I have specified that I want to use Python 3.6 in the virtual environment that I am creating:
virtualenv env2_py36 -p c: \ Python36 \ python.exe
The error already says that this usually happens when you install more than one version of Python on the same computer and warns that it is necessary to check the option Install for All Users to work (as I did) and also recommends placing the appropiate PythonXX.dll file in the Scripts folder of the virtual environment. However, I see that there is already a python36.dll file there.
Could anybody tell me what should I do to fix this problem?
On the other hand, I had previously created another virtual environment using Python 2.7. I use PyScripter to run my scripts but I don't know how to connect PyScripter to my virtual environment. It's still connected to the Python2.7's system installation.
This works for me:
virtualenv --python=python3.6 yourenvname
(3.6 is the current latest version of Python, but you can use whichever version you'd like.)
I have an installation of Ubuntu 14.04, which comes with Python 2.7 by default. If I were to install a Python package "foo", I would normally run pip install foo. The pip executable is found in /usr/bin.
However, I have now installed Anaconda, and I want to use this as my default Python interpreter. This means that when I run pip install foo, I want it to call Anaconda's pip, rather than the pip that comes with Ubuntu. In this way, installing a new package will copy it to Anaconda's site-packages directory, rather than that of the native Python installation.
Now, in my .bashrc file, I added export PATH=/home/karnivaurus/Libraries/Anaconda/bin:$PATH, and in that path is Anaconda's pip. However, this means there now exist two pip executables on PATH. How can I ensure that one which is called is that within the Anaconda distribution?
How can I ensure that one which is called is that within the Anaconda distribution
Executables on the PATH are inspected from left-to-right.
PATH=/home/karnivaurus/Libraries/Anaconda/bin:$PATH
Will now always use the Anaconda binaries if present.
If you would like to use the native pip, then you will need to qualify its path like so
/usr/bin/pip --version