Whilerelatively straightforward once you're familiar with it, the interaction between Spyder and other packages and environments can sometimes be confusing for first-time users. Improvements to Spyder have made this process much easier (and there is more to come!), but we'd like to clarify how that relationship works.
We'll start by helping you to debug a common problem encountered in Python when dealing with packages and environments, i.e. when you can't import a module even if you're sure that you've installed it. Next, we'll guide you through setting up your Spyder environment(s) to improve your workflow. If you're looking for a way to use Spyder with different environments (e.g. one for simple data analysis, one for machine learning, one for developing an app, etc.) you can go directly to the final section.
If the resulting paths are the same, then Spyder and the package are in the same environment, and import foo shouldn't produce an error (or else there is likely an unrelated issue with your installation).
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:
Therefore, if you'd like to use a package with your existing Spyder install (e.g. importing 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, this is not possible if you've used a standalone installer, and 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.
If you have an existing, pre-configured environment (such as for Keras or TensorFlow), are managing multiple environments (such as for development or testing purposes), or even would like to work within a totally separate Python installation as that in which Spyder is installed (such as a standalone installer Spyder with a separate Anaconda installation, or vice-versa), you can install the modular spyder-kernels package into any Python environment (conda environment, virtualenv/venv, system Python, WinPython, etc) in which you wish to work, and then change the Python interpreter used by Spyder on its IPython consoles to point to the Python executable of that environment.
This takes a small amount of preparation and configuration, but is much "lighter" and quicker than a full Spyder installation into that environment, avoids dependency conflicts, and opens up new workflow possibilities.
Start a new IPython console. All packages installed in your myenv environment should be available there. If conda is used, the name of the current environment and its Python version should be displayed in Spyder's status bar, and hovering over it should display the path of the selected interpreter.
Pip currently ignores uninstall commands that try to uninstall something owned by the OS. It doesn't error out, like it does with a missing package. So, now you can uninstall with the following process:
AFAIK sudo pip install will install on /usr/local/lib/pythonVERSION/dist-packages. You need to run sudo pip uninstall to uninstall packages system wide. It seems that pip freeze looks for package metadata and will list anything installed i.e. both from pip as well as apt-get outside of virtualenvs. There is -l option inside virtual environment to list packages only applicable to that virtual environment but it seems to be default case as well inside virtual environment. I think you can just delete related packages on /usr/local/lib/pythonVERSION/dist-packages as well but not very convenient method I guess.
To determine which Python packages were installed by pip, by the freeze command, which will give you a list of installed packages and their versions. I would suggest removing all instances, and re-installing using the sudo apt-get command
I needed to clean up disk space from Python packages safely. While this is a complete clean out of packages, I needed to move Python versions as well so I did not need old packages. I used the following to get all my package names, skip the first 2 lines and grab the first column, and uninstall without user interaction:
This has something to do with Homebrew. I had no issues with pyodbc on my Mac Air until I installed Homebrew and used it for a few things. I found this thread on github that ends in a solution that worked for me.
Install the version of scikit-learn provided by youroperating system or Python distribution.This is a quick option for those who have operating systems or Pythondistributions that distribute scikit-learn.It might not provide the latest release version.
If you have not installed NumPy or SciPy yet, you can also install these usingconda or pip. When using pip, please ensure that binary wheels are used,and NumPy and SciPy are not recompiled from source, which can happen when usingparticular configurations of operating system and hardware (such as Linux ona Raspberry Pi).
Scikit-learn plotting capabilities (i.e., functions starting with plot_and classes ending with Display) require Matplotlib. The examples requireMatplotlib and some examples require scikit-image, pandas, or seaborn. Theminimum version of scikit-learn dependencies are listed below along with itspurpose.
The Debian/Ubuntu package is split in three different packages calledpython3-sklearn (python modules), python3-sklearn-lib (low-levelimplementations and bindings), python3-sklearn-doc (documentation).Note that scikit-learn requires Python 3, hence the need to use the python3-suffixed package names.Packages can be installed using apt-get:
Compatibility with the standard scikit-learn solvers is checked by running thefull scikit-learn test suite via automated continuous integration as reportedon intel/scikit-learn-intelex. If you observe any issuewith scikit-learn-intelex, please report the issue on theirissue tracker.
It can happen that pip fails to install packages when reaching the default pathsize limit of Windows if Python is installed in a nested location such as theAppData folder structure under the user home directory, for instance:
I am trying to use Biopython using Spyder as IDE. I have installed Biopython in Linux Mint by using conda and also I have installed using pip. Everything seems okay, I tried in the terminal and in Spyder and it works. However, when I try to use the next order:
I checked if in the terminal if this works and exactly, the terminal doesn't give me any error message. I checked if Python's version is the problem, but the terminal and Spyder are working in the same Python's version (3.7). I have also checked with other entries such as:
Hi,I've seen this before but I don't recall the root cause. But from that you've posted I thing that you have 2 Pythons and 2 BioPythons installed. And you are trying to import BioPython A from "Python B".
If you would like to use spyder with conda env, then this env must be avalible to Spyder. In Pycharm (which I use) there is special setting for executable PATH independent on environment variables, so maybe it might be similar in Spyder.
The /home/andrea/anaconda3/bin/python means that you are using conda python. And you should manage your python packages by conda not by pip. Now I think that You've installed Biopython with pip to conda env - this is not good idea (link attached at the end on combining conda and pip).
Since importing SeqIO gives you the error message I think that you either don't have biopython installed in your conda env (you didn't posted results from conda list) or that the installation is broken.
If you are new to Python and/or do not have familiarity with Python virtualenvironments, then we recommendstarting by installing the Anaconda Distribution. This works on all platforms (linux,Mac, Windows) and installs a full-featured scientific Python in a user directorywithout requiring root permissions.
In most cases, this will install a pre-compiled version (called a wheel) ofastropy, but if you are using a very recent version of Python, if a new versionof astropy has just been released, or if you are building astropy for a platformthat is not common, astropy will be installed from a source file. Note that inthis case you will need a C compiler (e.g., gcc or clang) to be installed(see Building from source below) for the installation to succeed.
If you get a PermissionError this means that you do not have the requiredadministrative access to install new packages to your Python installation. Inthis case you may consider using the --user option to install the packageinto your home directory. You can read more about how to do this in the pipdocumentation.
There may be a delay of a day or two between when a new version of astropyis released and when a package is available for conda. You can checkfor the list of available versions with conda search astropy.
To also be able to run tests (see below) and support Building Documentation use thefollowing. We use pip for these packages to ensure getting the latestreleases which are compatible with the latest pytest and sphinx releases:
certifi: Useful when downloadingfiles from HTTPS or FTP+TLS sites in case Python is not able to locateup-to-date root CA certificates on your system; this package is usuallyalready included in many Python installations (e.g., as a dependency ofthe requests package).
You will need a compiler suite and the development headers for Python in orderto build astropy. You do not need to install any other specific builddependencies (such as Cython) since these aredeclared in the pyproject.toml file and will be automatically installed intoa temporary build environment by pip.
3a8082e126