(base) Admin's-iMac:~ admin$ , what is this (base)? After conda install - tensorflow

I installed anaconda2 on my iMac. Then I use anaconda2 to install tensorflow.
Either by using
conda install -c conda-forge tensorflow
Or by using Anaconda Navigator, search the package tensorflow and then select to install.
In both cases, after I did the tensorflow installation. my command line terminal changed to
(base) Admin's-iMac:~ admin$ , (base) showed up now. What is this (base)?
In my .bash_profile,
# added by Anaconda2 2018.12 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/admin/anaconda2/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
\eval "$__conda_setup"
else
if [ -f "/Users/admin/anaconda2/etc/profile.d/conda.sh" ]; then
. "/Users/admin/anaconda2/etc/profile.d/conda.sh"
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/Users/admin/anaconda2/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda init <<<
I have these lines.
So it seems some of the conda setup conditions met, and
CONDA_CHANGEPS1=false conda activate base
So my login terminal will "conda activate base", using conda virtualenv.
So now my terminal showed (base) each time I opened the terminal window. Does it mean some errors happened with my conda or conda packages installation?
To get rid of the (base), I need to reinstall anaconda2.
Thanks!

Pretty late but anyway - I got the same using miniconda on wsl, windows.
You can turn it off by - $conda deactivate and the terminal comes back to normal.

Related

osmNX in Google Colab

For my purposes I require osmNX in Google Colab
Has anyone done this before? I use the following commands:
!wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh && bash Anaconda3-2019.07-Linux-x86_64.sh -bfp /usr/local
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
!conda config --prepend channels conda-forge
The command:
!conda info --envs
Shows that the enviroment is created succesfully.
When I run the command:
!conda activate ox
The error is displayed:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
The command
!conda init bash
has no effect.
Thanks for the help
!apt-get -qq install -y libspatialindex-dev && pip install -q -U osmnx
import osmnx as ox
ox.config(use_cache=True, log_console=True)
you can use this command !
!pip install geopandas== 0.10.0
!pip install matplotlib==3.4
!pip install networkx==2.6
!pip install numpy==1.21
!pip install pandas==1.3
!pip install pyproj==3.2
!pip install requests==2.26
!pip install Rtree==0.9
!pip install Shapely==1.7
!pip install osmnx
I installed the respective packages based on the requirements provided in this link https://github.com/gboeing/osmnx/blob/main/requirements.txt , it has worked in my application so far, hope it works for you too.
Alternatively, similar to another answer, you can use the code below, found in https://stackoverflow.com/a/65378540/18403512:
!apt install libspatialindex-dev
!pip install osmnx
The answer would be similar to running osmnx on any docker or external server.
I tried it and almost got there, maybe someone can help make it complete.
So let's start with the basic osmnx installation:
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
Then, let's look at how can this be done at remote docker, e.g. travis CI (working sample .travis.yml from one of my repos):
- bash miniconda.sh -b -p $HOME/miniconda
- source "$HOME/miniconda/etc/profile.d/conda.sh"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- conda config --prepend channels conda-forge
- conda create -n ox --strict-channel-priority osmnx
- conda activate ox
Then we may take a look at how to have conda in colab and use this snippet:
%%bash
MINICONDA_INSTALLER_SCRIPT=Miniconda3-4.5.4-Linux-x86_64.sh
MINICONDA_PREFIX=/usr/local
wget https://repo.continuum.io/miniconda/$MINICONDA_INSTALLER_SCRIPT
chmod +x $MINICONDA_INSTALLER_SCRIPT
./$MINICONDA_INSTALLER_SCRIPT -b -f -p $MINICONDA_PREFIX
which then finally boils down to this almost working notebook, based on this post.
What is not working is switching between environments, so !conda env list returns ox as one of environments, yet activating it fails:
!conda activate ox
raises:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.

import tensorflow working in terminal but not in jupyter notebook

I used the following guide to install tensorflow-gpu - https://towardsdatascience.com/tensorflow-gpu-installation-made-easy-use-conda-instead-of-pip-52e5249374bc
I created a new environment and installed tensorflow-gpu using the command -
conda create --name tf_gpu tensorflow-gpu
If I activate the environment, start python in terminal, and import tensorflow from the terminal, it works.
BUT
When I activate the environment, run a jupyter notebook and type -
import tensorflow
I get module not found error. How do I resolve this?
Start Command Promt (CMD) as administrator (right click). Do not enter any environment yet.
Install Jupyter (and nb_conda as well as ipykernel) to get your environments listed: conda install jupyter nb_conda ipykernel
Activate the environment you want to add to jupyter kernel: conda activate myenv
Install ipykernel in the environment (do this for all envvironemnts you would like to add): conda install ipykernel
To start Jupyter, cd to root (cd .. until you are at C:) then type (does not need to be inside and env): Jupyter noteboook
You might need to confirm that it shall open in a web browser (I use chrome)
Once open in a browser navigate to the folder of your choice, then make a new python 3 file.
Once inside click Kernel -> Change kernel and select the conda env you would like
You should now be able to change kernel (env) within all conda environments that have ipykernel installed (step 4)

conda install -c conda-forge tensorflow just stuck in Solving environment

I am trying to run this statement in MacOS.
conda install -c conda-forge tensorflow
It just stuck at the
Solving Environment:
Never finish.
$ conda --version
conda 4.5.12
Nothing worked untill i ran this in conda terminal:
conda upgrade conda
Note that this was for poppler (conda install -c conda-forge poppler)
On win10 I waited about 5-6 minutes but it depends of the number of installed python packages and your internet connection.
Also you can install it via Anaconda Navigator
One can also resolve the "Solving environment" issue by using the mamba package manager.
I installed tensorflow-gpu==2.6.2 on Linux (CentOS Stream 8) using the following commands
conda create --name deeplearning python=3.8
conda activate deeplearning
conda install -c conda-forge mamba
mamba install -c conda-forge tensorflow-gpu
To check the successful usage of GPU, simply run either of the commands
python -c "import tensorflow as tf;print('\n\n\n====================== \n GPU Devices: ',tf.config.list_physical_devices('GPU'), '\n======================')"
python -c "import tensorflow as tf;print('\n\n\n====================== \n', tf.reduce_sum(tf.random.normal([1000, 1000])), '\n======================' )"
References
Conda Forge blog post
mamba install instead of conda install
The same error happens with me .I've tried to install tensorboard with anaconda prompt but it was stuck on the environment solving .So i've added these paths to my environment variables:
C:\Anaconda3
C:\Anaconda3\Library\mingw-w64\bin
C:\Anaconda3\Library\usr\bin
C:\Anaconda3\Library\bin
C:\Anaconda3\Scripts
and it worked well.
Follow the instruction by nekomatic.
I left it running for 1 hour. Yes. it is finally finished.
But now I got the conflicts
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- anaconda==2018.12=py37_0 -> bleach==3.0.2=py37_0
- anaconda==2018.12=py37_0 -> html5lib==1.0.1=py37_0
- anaconda==2018.12=py37_0 -> numexpr==2.6.8=py37h7413580_0
- anaconda==2018.12=py37_0 -> scikit-learn==0.20.1=py37h27c97d8_0
- tensorflow
Use "conda info <package>" to see the dependencies for each package.

TensorFlow Object Detection installation error tensorflow/models/research/

As the title says I have a problem with installing TensorFlow Object Detection.
My system:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 17.04
Release: 17.04
Codename: zesty
and achitecture:
uname -i
x86_64
These are the steps I took exactly.
First I verified my python installation:
python -V Python 2.7.13
And my pip installation:
pip -V pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
After that I set the url to latest tensorflow version.
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linu/cpu/tensorflow-1.4.0-cp27-none-linux_x86_64.whl
And then I installed tensorflow.
sudo pip install tensorflow
After this I verified the installation:
python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
And got Hello, TensorFlow! as response.
Now comes the trouble...
I tried following this guide:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md
Ran:
sudo apt-get install protobuf-compiler python-pil python-lxml
sudo pip install jupyter
sudo pip install matplotlib
And those commands all executed successfully.
The next step gave me my problems though..
The guide does not say what directory tensorflow/models/research/ is (if it's created automatically or should be created by the user and in that case where?)
So I googled a bit and found this one: https://github.com/tensorflow/models/issues/2253
stating that I should just create it... but doing so made the next command executed from that newly created directory
protoc object_detection/protos/*.proto --python_out=.
fail with error object_detection/protos/*.proto: No such file or directory.
I created the directory in tester#tester-vm:~/Documents$ so the full directory path became tester#tester-vm:~/Documents/tensorflow/models/research$.
I'm guessing that I shouldn't create the directory by myself anyway but would love some tips!
Assuming you checked out the models repo (git clone https://github.com/tensorflow/models.git), the tensorflow/models/research/ directory is the research directory in this repo. Basically, this directory: https://github.com/tensorflow/models/tree/master/research

GraphLab Create Launcher Installation Error Windows: There was an error creating the "gl-env" conda environment

I received the following error when trying to install GraphLab Create on Windows.
There was a problem creating the "gl-env" conda environment. Restart GraphLab Create Launcher.
Any advice on how to fix this?
In order to solve the problem I had to slightly modify the
https://turi.com/download/install-graphlab-create-command-line.html.
procedure with the following changes:
Step 1: Download Anaconda2 v4.0.0
Step 2: Install Anaconda
Run Anaconda2 v4.0.0 installer.
Double-click the .exe file to install Anaconda and follow the instructions on the screen.
Step 3: Create conda environment
Create a new conda environment with Python 2.7.x
CD anaconda2/scripts/
conda install -n root _license
conda update pip
conda create -n gl-env python=2.7 anaconda=4.0.0
Activate the conda environment
activate gl-env
Step 4: Ensure pip version >= 7
Ensure pip is updated to the latest version
miniconda users may need to install pip first, using conda install pip
CD anaconda2/envs/gl-env/
conda install pip or conda update pip
Install your licensed copy of GraphLab Create
pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/ your registered email address here/your product key here/GraphLab-Create-License.tar.gz
Step 6: Ensure installation of IPython and IPython Notebook
Install or update IPython and IPython Notebook
conda install ipython-notebook
Step 7: Start IPhyton Notebook
Start IPhyton from gl-env
ipython notebook
Use following command:
conda create -n gl-env python=2.7 anaconda
instead of:
conda create -n gl-env python=2.7 anaconda=4.0.0
Note: gl-env can be replaced by any name eg. gbl-env. It does not need to be gl-env only.
Later you can follow the steps from turi.com or the following reference:
Reference
It seems that the work around for this issue right now is to use the command line instructions to install GraphLab Create. Note that these instructions are only for people who have previously tried to install using the GraphLab Create Launcher. If you have not installed any GraphLab products, then you can start at Step 1 of the command line instructions:
Go to Control Panel > Programs > Programs and Features.
In this panel, uninstall all instances of "GraphLab Create Launcher".
Reboot.
Reinstall GraphLab Create using the command line method starting at "Option 1: Step 2: Ensure pip version >= 7": https://turi.com/download/install-graphlab-create-command-line.html.
GraphLab Installation Steps on Windows:
Go to turi.com → Hover over Coursera Students → Click on Academic Licenses → Register → Check your email
Download Anaconda2 v4.0.0
Install it
Open Anaconda Navigator
Create a GraphLab environment using create button at the bottom of the interface, select python version 2.7, name it "gl-env"
Environments tab → Create → Python version = 2.7 → gl-env
Sample Image
N.B: It may take some time
Then select gl-env and clik play button, some options will pop up, select terminal
gl-env → Play button → Terminal
Execute the following command
python -m pip install pip==9.0.1
8.Execute the following command replacingYour email and license that has been sent to your email:
pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/your email/license/GraphLab-Create-License.tar.gz
Execute the following command
conda install ipython-notebook
Click on Open with python notebook on your gl-env play button from anaconda navigator
Now execute the following command on Jupyter notebook
graphlab.get_dependencies()
Then execute
import graphlab
Hopefully you are all set