ModuleNotFoundError in Spyder - package

I tried to import the biopython package in Spyder and got the error message:
ModuleNotFoundError: No module named 'biopython'
although biopython is installed.
I also checked the PYTHONPATH: there is a path set into the directory where the packages are stored.
Can somebody help? Did I miss something? Thanks for your help!

If you're using Anaconda, it's best to install all the packages you want from Anaconda if possible. You can check if a package is available with (e.g.):
conda search biopython
When I try that command it shows that biopython is available, so assuming you have access to the standard conda channels you should be able to get it this way.
Assuming you haven't already created a conda environment to work with, start by creating a new one with the packages you want to use:
conda create -n myenvname spyder biopython
where myenvname is the name you want to give the environment - call it whatever you like. If you want to use other packages as well, add their names to the end of this command. Then once the env is completed, activate it:
activate myenvname
or if this doesn't work, on Mac or Linux:
source activate myenvname
and start Spyder in this environment:
spyder
Each time you want to use this environment in future you will need to activate it first. You may also be able to do some of these tasks through the Anaconda Navigator or via Start menu shortcuts but the command line version will always work.
If there's a package you want that isn't available from conda but is available via pip, just use the pip command after creating and activating the environment.

If you are using Anaconda, a solution could be
conda install -c main biopython
following https://anaconda.org/main/biopython.
The official repository page helped me when I got your error message because numpy was not in place.

Related

Spyder Version 5 Standalone With Mini Conda Commands

I am using Spyder version 5 the standalone version with Miniconda.
I was hoping someone could shed some light on the following questions:-
I know how to update all the packages within a given environment, however does anyone know what the command is to update a specific package within a given environment and how to delete a specific package within a given environment?
Does anyone know what the command is to upgrade Python from say 2.7 to 2.8 using Spyder standalone within mini conda.
When I remove an environment I get the following message in mini conda:-
"Remove all packages in environment C:\ProgramData\Miniconda3\envs\minicdm:" - Whats all this about???
And finally I am trying to create a list of common commands for newbies like myself and I was wondering if anyone could add anything to the list I currently have:-
4.1 conda env list - List all environments and places an asterisk to which environment is active.
4.2 conda deactivate - Deactivates active environment, you may or may not need to be in the folder to deactivate it
4.3 conda env remove -n - Removes the environment, must be deactivated before it can be removed.
4.4 conda update -n --all - Updates all the packages within a given environment.
4.5 conda create -n -y - Creates a conda environment
4.6 conda activate - Activates a conda environment
4.7 conda install spyder-kernels scikit-learn -y - Installs a package in the activate environment
Thank you.
Do not rely on third-party information. Read the the docs:
https://docs.conda.io/projects/conda/en/latest/user-guide/index.html

Where does sdkman install packages?

I used sdkman to install groovy which went fine. Where is the installed package now? I need the path for it. I am on Ubuntu 14.04.
I've checked it on my system. It should be located in $HOME/.sdkman/candidates/.
I think the best way would be to use SDKMan's home command:
https://sdkman.io/usage#home
Something like this (taken from the above page):
$ sdk home java 11.0.7.hs-adpt
/home/somedude/.sdkman/candidates/java/11.0.7.hs-adpt
Upon installation, SDKMAN creates an environment variable $SDKMAN_DIR which points to the installation directory.
Usuall it's ~/.sdkman
After you have run source $HOME/.sdkman/bin/sdkman-init.sh.
You can see the sdkman "installation" by running:
declare -f
$HOME on mac is /Users/<users>
Where's SDKMan installed:
echo #SDKMAN_DIR
Where did it just install gradle? (or some other package)
which gradle
SDKMAN stores file in $HOME/.sdkman/candidates/ as Tom mentioned and this answer goes into more detail.
To find where SBT 1.3.13 is installed, type sdk home sbt 1.3.13. It'll return something like /Users/powers/.sdkman/candidates/sbt/1.3.13.
The arguments to the sdk install command align with where the files are stored in $HOME/.sdkman/candidates.
sdk install java 8.0.272.hs-adpt stores files in $HOME/.sdkman/candidates/java/8.0.272.hs-adpt.
sdk install sbt 1.3.13 stores files in $HOME/.sdkman/candidates/sbt/1.3.13.
When you run sdk install, the downloaded binaries get saved in $HOME/.sdkman/archives. For example, $HOME/.sdkman/archives/java-8.0.272.hs-adpt.zip and $HOME/.sdkman/archives/sbt-1.3.13.zip.
Some of the binaries are pretty big and can end up taking a lot of space on your computer. You should periodically delete them with the sdk flush archives command. Once you install the software, you don't need the binaries anymore. See here for more details.

What are dronekit-python dependencies?

The dronekit Getting Started page suggests installing WinPython to use dronekit-Python on Windows because it includes the dependencies. I already have a working Python installation and I prefer not to risk messing it up with WinPython. What are the dependencies I need to install?
As of DKPY 2.0 this is outdated. Also, I might move to making a MavProxy module depending on whether or not the unpaid devs decide to stay when 3DR stops funding Dronekit
I've written a procedure to help with this problem which I've pasted. 3DR claims they're going to fix it, but in the mean time I hope this will help.
This setup is for Windows 64-bit systems only, although similar procedures will work with 32-bit.
Install MAVProxy and run it once before reaching step 5.
Install Notepad++.
Install Python v2.7.
Inside the Python folder, run WinPython Control Panel and select Advanced->Register Python.
Inside the same folder, run WinPython Command Prompt and input the following four commands:
• pip uninstall python-dateutil
• pip install droneapi
• pip install console
• echo module load droneapi.module.api >> %HOMEPATH%\AppData\Local\MAVProxy\mavinit.scr
Install WX Python. It should be the 64-bit Python 2.7 version.
Download and install OpenCV 2.4.11 to any folder
• Copy/paste the file cv2.pyd from OpenCV\build\python\2.7\x64\ to \python-2.7.6.amd64\Lib\site-packages.
Steps 8 through 11 apply to SITL only
Follow the online documentation for setting up Cygwin for SITL in Windows
Go to C:\cygwin\home\Your Username\ardupilot\Tools\autotest\
Open sim_vehicle.sh in Notepad++
• Change line 429 from…
cygstart -w "/cygdrive/c/Program Files (x86)/MAVProxy/mavproxy.exe" $options --cmd="$extra_cmd" $*
to...
cygstart -w "/cygdrive/c/Users/YOUR USERNAME HERE/Desktop/WinPython-64bit-2.7.6.4/python-2.7.6.amd64/Dronekit/Scripts/mavproxy.py" $options --cmd="$extra_cmd" $*
Note: This location changes depending on where you installed WinPython. For me, it was the desktop.
Start simulations as you would normally for SITL. To run Python scripts during the simulations, use the command
• api start Path to script\script_name
To use the code to connect to an actual copter, open WinPython Command Prompt
• Navigate to the folder which contains the scripts you wish to test
• Type mavproxy.py --master=”com##”,57600
• Run your script by typing into the MAVProxy terminal
o api start script_name

ROS package not found after catkin_make

I created a ROS workspace following the Wiki page from ROS. I also created a package using catkin_create_pkg under the workspace I just created.
Then, following the steps in ROS Wiki to build the package using catkin_make, after the package is built, I insert the command rospack find packagename, and my package is not found anymore.
Can anyone help me on this?
Have you followed this basic tutorial? You have to create the package in your workspace and have set properly your Bash file (in your home directory).
To permanently set your system, add these lines
# ROS settings
source <your_workspace_path>/catkin/devel/setup.bash
at the end of your ~/.bashrc. Then, restart the terminal, and retry. Please, be sure to modify these lines with your actual information, where I've put <your_workspace_path> (depends on where you have installed ROS and its workspace on your PC).
If this does not solve the problem, try rospack profile before rospack find <your_package_name>.

rethinkdb index-rebuild complains python driver is missing

Ran into this error when trying to run rethinkdb rebuild command:
Error when launching 'rethinkdb-index-rebuild': No such file or
directory The rethinkdb-index-rebuild command depends on the RethinkDB
Python driver, which must be installed. If the Python driver is
already installed, make sure that the PATH environment variable
includes the location of the backup scripts, and that the current user
has permission to access and run the scripts.
Yet I have the rethinkdb python module installed and path setup properly:
Requirement already satisfied (use --upgrade to upgrade): rethinkdb in
/Library/Python/2.7/site-packages Cleaning up...
Why doesn't this work?
If the rethinkdb-index-rebuild script is not in your PATH, you might be able to invoke the index-rebuild command as
python -mrethinkdb._index_rebuild
Turns out it was a feature implemented in a newer version of the python module. Solved it by:
sudo pip install --upgrade rethinkdb

Resources