python 2.7 not installed properly by anaconda - python-2.7

I'm using Ubuntu Linux 18.04, have anaconda 3 loaded with python 3.7.3 installed. I follow the instructions to create a new environment with python 2.7 installed and it fails. Any idea what I'm doing wrong?
$ conda create -n py27 python=2.7 anaconda
Collecting package metadata (current_repodata.json): done
Solving environment: done
Package Plan
environment location: ....../...../anaconda3/envs/py27
added / updated specs:
- anaconda
- python=2.7
but after all the install, when I activate this environment, and then get the info, it is pointing to python 3.7.3.
$ conda info
active environment : py27
active env location : /home/myusername/anaconda3/envs/py27
shell level : 2
user config file : /home/myusername/.condarc
populated config files : /home/myusername/.condarc
conda version : 4.7.10
conda-build version : 3.18.5
python version : 3.7.3.final.0
virtual packages : __cuda=9.1
base environment : /home/myusername/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
package cache : /home/myusername/anaconda3/pkgs
/home/myusername/.conda/pkgs
envs directories : /home/myusername/anaconda3/envs
/home/myusername/.conda/envs
platform : linux-64
user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Linux/4.15.0-55-generic ubuntu/18.04.2 glibc/2.27
UID:GID : 1000:1000
netrc file : None
offline mode : False

Related

The folder you are executing pip from can no longer be found

I have a virtual machine under Hyper V that represents a cluster single-node of Hortonworks Data Platform with the following characteristics:
OS: centos 7.6.1810 minimal
python: 2.7.5
I installed pip package with the following command :
yum -y install python-pip
The installation is well finished, but when I want to check the version of pip pip -V it gives me this error : The folder you are executing pip from can no longer be found.
My folder /usr/local/bin/ does not contain any files or folders.
paths of python2.7 : /usr/bin/python2.7 /usr/bin/python2 /usr/bin/python
the cmd which python returns : /bin/python
paths of pip : /usr/bin/pip /usr/bin/pip2 /usr/bin/pip2.7
which -a pip
/bin/pip
/usr/bin/pip
I'm stuck thanks for helping me please.
Alternatively, kill your terminal, and start a new one.
Adding it as an answer since it worked. Pip requires a log out/log in to set environment variables.
Log out and log back in, try again and it seems to have worked.

How to make changes in Airbnb Superset?

I deployed Superset on Ubuntu 14.04 from the source code and it works fine. Now I want to play with the superset code to make required changes. Like adding the Png downloadable option for charts.I made changes but it didn't reflect Superset build. How to make changes in Superset code that should reflect Superset on browser?
code Build Process:
git clone https://github.com/airbnb/superset
cd ${SUPERSET_HOME}/superset/assets
npm install : Will install the npm dependencies
pip install virtualenv : Will install virtualenv
virtualenv venv : Set virtualenv
. ./venv/bin/activate : activate virtualenv
pip install --upgrade setuptools pip : Will upgrade
npm run prod : Set NODE_ENV variable and run dependencies
cd ${SUPERSET_HOME}
python setup.py install
//Create an admin user :
fabmanager create-admin --app superset
//Initialize the database :
superset db upgrade
//Load some data to play with :
superset load_examples
//Create default roles and permissions :
superset init
//To start the server : superset runserver -p 9002
You can read all the details here: https://github.com/airbnb/superset/blob/master/CONTRIBUTING.md#setting-up-a-python-development-environment
The main idea is to install for development using:
python setup.py develop
And run dev server:
superset runserver -d

Python can't inport pydicom: ImportError: No module named dicom

I am new Ubuntu and Python, so any help will be appreciated.
I need to write Python program that works with dicom images. (MRI data)
I installed pydicom with:
conda install --channel https://conda.anaconda.org/auto pydicom
(after trying pip install and comda install)
in conda list I sea:
"pydicom * 0.9.8 py27_0 auto "
When running: import dicom
in Jupyter notebook, I get:
ImportError: No module named dicom
( I tried "import pydicom as dicom" same error)
Ubuntu version: Ubuntu 14.04.4 LTS
conda 4.0.6
Python 2.7.11 :: Anaconda custom (64-bit)
Jupyter version: 4.1.0
I suspect that I have some problem with environment variables,
when i try to run ipython notebook, I get:
ImportError: No module named backports.shutil_get_terminal_size
but jupyter notebook, is working.
When I run: locate -i dicom
I see dicom in spyder directories only:
/home/naomi/anaconda/lib/python2.7/site-packages/spyderplugins/io_dicom.py
/home/naomi/anaconda/lib/python2.7/site-packages/spyderplugins/io_dicom.pyc
/home/naomi/anaconda/pkgs/spyder-2.3.5.2-py27_0/lib/python2.7/site-packages/spyderplugins/io_dicom.py
/home/naomi/anaconda/pkgs/spyder-2.3.5.2-py27_0/lib/python2.7/site-packages/spyderplugins/io_dicom.pyc
/home/naomi/anaconda/pkgs/spyder-2.3.8-py27_1/lib/python2.7/site-packages/spyderplugins/io_dicom.py
/home/naomi/anaconda/pkgs/spyder-2.3.8-py27_1/lib/python2.7/site-packages/spyderplugins/io_dicom.pyc
When I run: locate -i pydicom
I don't get any directory.
Is it installed ?

DoError Using Ansble with Digital Ocean

I've read the posts, I've seen the ticket about the dopy version and I've tried to do my due diligence, but...
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'DoError' is not defined
This is still kicking my arse. I'm running OS X El Capitan. I've installed python + pip via Homebrew and I've tried installing Ansible via both Homebrew and pip. I'm still getting the error. What am I missing?
$ which python
/usr/local/bin/python
$ which pip
/usr/local/bin/pip
$ which ansible
/usr/local/bin/ansible
$ python --version
Python 2.7.11
$ pip --version
pip 8.1.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
$ ansible --version
ansible 2.0.1.0
config file = /Users/robwilkerson/Development/uw/ansible-servers/ansible.cfg
configured module search path = Default w/o overrides
$ pip list
...
dopy (0.3.5)
...
I've tried everything I can think of. If I use the system python and try to install pip without ansible I get an OpenSSL error that's a known issue.
I could really use a shove in the right direction.
I recommend to:
use Python 3.x
use virtual environment for ansible and python modules, eg. python3 -m venv ~/.venv && . ~/.venv/bin/activate
pip install -IU pip && pip install ansible dopy

Installing django on two existing versions on python

I have both python 2.7 and 3.2 installed on my computer and I wanted to install django. And when I did it automatically installed django 1.4 on python 3. Is there a way I can install it on python 2.7?
You can mention explicitly the python version while installing.
First download the source from django website.
Now extract it to any location and open the terminal and go to the location into the folder. There must be a file named setup.py that is the installation file.Now type:
For Python 3.2
python3.2 setup.py install
For Python 2.7
python2.7 setup.py install
The real answer here is that you should be using virtual environments, as they both solve this particular problem, and are the industry standard because they solve many problems.
Simple process:
install python-virtualenv :
$>sudo apt-get install python-virtualenv # on Ubuntu
create a virtual-env against the Python you want, and activate it
$> virtualenv -p /usr/bin/pythonX ve
$> source ve/bin/activate
install django into this virtual-env
$> pip install django
...
PROFIT!