Spyder Version 5 Standalone With Mini Conda Commands - package

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

Related

mamba upgrade to 1.x

I have mamba 0.27 installed on my mac OS.
How can I upgrade to mamba 1.x?
Can I simply do a fresh re-installation of the newer version, if I want to keep my existing mamba environments and settings?
I checked mamba's documentation, and I searched in internet, but could not find any "how to upgrade" information.
thanks!
Mamba is like any other package in a Conda environment and can be updated like:
mamba update -n base mamba
If that doesn't update (perhaps due to needing dependencies updated), another option is to use a minimum version:
mamba install -n base 'mamba>=1'
Please note the use of quotations to avoid the > being interpreted writing to a file called "=1".

ModuleNotFoundError in Spyder

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.

Matlab integration - Run and test Matlab VOLTTRON Integration - pyzmq error+ volltron/config. path

Below the steps followed to integrate a fake building - fake modbus device (Ubuntu 16.04 LTS) with matlab-based interface.
Following the documentation steps at: http://volttron.readthedocs.io/en/4.1/devguides/walkthroughs/DrivenMatlabAgent-Walkthrough.html
Installation steps for system running Matlab:
Install python (my Python versions: 3.6.3 and 2.7.12)
Install pyzmq following the steps at (https://github.com/zeromq/pyzmq): I use pip install pyzmq
I get
Requirement already satisfied: pyzmq in ./env/local/lib/python2.7/site-packages
Steps for system running Matlab:
Install python – done
Install pyzmq –done
Install Matlab-- done (R2017b)
run pyversion --done
version: '2.7'
executable: '/home/USER_NAME/volttron/env/bin/python'
library: 'libpython2.7.so.1.0'
home: '/home/USER_NAME/volttron/env'
isloaded: 0
when I run py.zmq.pyzmq_version() I get
ans =
Python str with no properties.
15.4.0
I copied the example.m to the desktop.
Run and test Matlab VOLTTRON Integration:
To run and test the integration:
Assumptions
Device driver agent is already developed (master_driveragent-3.1.1- is installed)
Installation:
Install VOLTTRON –done
Add subtree volttron-applications under volttron/applications by using the following command –
For adding subtree: I used the code:
git subtree add --prefix applications https://github.com/VOLTTRON/volttron- applications.git develop --squash
error
(Working tree has modifications. Cannot add.)
Configuration
Copy example configuration file applications/pnnl/DrivenMatlabAgent/config_waterheater to volltron/config. (I could not find a path called config?)
Questions
Please is there any issue in pyzmq ?
In the volttron root I run the subtree command, why it is not accepting to add the subtree?
What is the volltron/config. path?
Thanks,
Looks like you have you have local changes in your cloned volttron directory. Please stash or commit those changes before adding subtree.
If config folder does not exists you can create it (I will make a note of it in the documentation as well) It is only a location to copy the config file to make changes ( config_url and data_url )

conda packages with version name of 'custom'

When I using conda search anaconda I found a few custom version packages, shown as follow:
Fetching package metadata: ....
anaconda 1.6.0 np17py33_0 defaults
... ... ...
4.0.0 np110py35_0 defaults
4.0.0 np110py34_0 defaults
4.0.0 np110py27_0 defaults
custom py35_0 defaults
custom py34_0 defaults
custom py27_0 defaults
Note that these three custom version pkgs are shown at the end of conda search anaconda results, so they are considered the newest version by conda, which also affects conda install anaconda results (so I have to using conda install anaconda=4.0.0).
Then conda info anaconda=custom gives following results:
Fetching package metadata: ....
anaconda custom py35_0
----------------------
file name : anaconda-custom-py35_0.tar.bz2
name : anaconda
version : custom
build number: 0
build string: py35_0
channel : defaults
size : 3 KB
date : 2016-03-14
license : BSD
md5 : 47c237b38bfc175cb73aed8b8b33ade7
space : python
installed environments:
dependencies:
python 3.5*
anaconda custom py34_0
----------------------
file name : anaconda-custom-py34_0.tar.bz2
name : anaconda
version : custom
build number: 0
build string: py34_0
channel : defaults
size : 3 KB
date : 2016-03-14
license : BSD
md5 : 767a59923372d998b8c83fb16ac035a1
space : python
installed environments:
dependencies:
python 3.4*
anaconda custom py27_0
----------------------
file name : anaconda-custom-py27_0.tar.bz2
name : anaconda
version : custom
build number: 0
build string: py27_0
channel : defaults
size : 3 KB
date : 2016-03-14
license : BSD
md5 : 8288aef529d5a46d07bd84b4fcf4308a
space : python
installed environments:
dependencies:
python 2.7*
BUT I don't know/remeber HOW and WHY these three packages appear in this computer, can anyone explain:
How these custom version pkgs are created in the first place?
How/Why these custom version pkgs are shown in the conda search results?
How to remove these custom version pkgs?
The one custom version of any package that exists (right now, in the official repos) is for the anaconda package.
Here's there reason... The anaconda conda packages are metapackages, meaning they are packages of packages--or packages that have no real source code and only bring in a bunch of dependencies. Each anaconda package has every sub-package pinned to an explicit and specific version of that sub-package. That's because Continuum does extensive testing on the interoperability of that set of packages (and those specific versions).
Now, after you've installed anaconda, either through the Anaconda Installer or installing Miniconda and then conda install anaconda, you have a set of packages with all of these tested guarantees. There's no reason you have to stick to this locked set of packages--you can install anything and any version you want. You no longer have a version-identifiable Anaconda Distribution though. You've customized it. Thus, when you run conda list and the version of the anaconda package shows custom, you know you've diverged from the set of packages in the Anaconda Distribution that are robustly tested for interoperability.
Your conda search anaconda query just reflects an artifact of how this is implemented. You'll notice in that query that custom packages are listed first, meaning they have the lowest sort order when comparing versions. Thus, if you run conda update anaconda after you've diverged from the specifically-pinned anaconda packages, you'll be back to a numbered version of the Anaconda Distribution.
This is really a partial answer. I'm not positive why exactly this version exists.
(1) In terms of the specific version value of custom it seems this is allowed from here:
version: string
The package version, which may not contain -. Conda acknowledges PEP 440.
So this anaconda package would be created in the same way as any of the other versions. I would assume using conda build.
(2) They are shown in the search results because they exist in the anaconda cloud. It seems this is an officially released version of anaconda.
As for why it exists, if you download one of the actual package files (for example linux-64-anaconda-custom-py35_0.tar.bz2), expand it, and read the info/index.json file it looks like this package will simply install python and the other bare bones needs. Compare this to anaconda version 4.0.0, or one of the others, and you will see a ton of packages. I assume this package exists so that if someone installs the custom version they will just get the bare bones packages and then they go through conda install-ing any others they want.
For example, look at the packages when you do conda create -n anc-test anaconda=4.0.0 vs. conda create -n anc-test anaconda=custom.
EDIT: Just saw that that is also in your conda info so you are probably already aware of the difference in dependencies.
(3) I don't think you can remove these custom packages from your search call as they are legitimate packages in the anaconda cloud. You might be able to exclude them from the conda search via regex. It doesn't look like from your output that they have been installed -- at least not in the current environment.

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

Resources