Thursday, January 27, 2022

Linux Command Prompt Displays (base), why?

Upon logging to a Linux host, I observe that the command prompt contains (base), e.g,


(base) user@host ~] $

Variable PS1 has the value of (base) [\u@\h \W]\$


(base) [user@host ~] $ echo $PS1
(base) [\u@\h \W]\$

This is because we had Anaconda installed and Anaconda is showing which virtual environment we are in. To get rid of this, we can deactivate this by


conda config --set auto_activate_base false

Tuesday, January 25, 2022

Install pygraphviz on Windows

I wanted to install python package pygraphiz on Windows. However, I encountered an error, as shown below,


C:> python -m pip  install pygraphviz
python -m pip  install pygraphviz
Collecting pygraphviz
  Using cached pygraphviz-1.8.zip (119 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pygraphviz
  Building wheel for pygraphviz (setup.py) ... error
  ERROR: Command errored out with exit status 1:
  ...
  ...
  ...
  pygraphviz/graphviz_wrap.c(2711): fatal error C1083: Cannot open include file: 'graphviz/cgraph.h': No such file or directory
  ...
  ...
  ...

Clearly, the problem is that pip cannot locate the graphviz's header files. Given that I have already installed Graphviz, I reran the pip command as follows, and it solved the problem.


set GRAPHVIZPATH=C:\Applications\Graphviz\Graphviz2.50
python -m pip install --global-option=build_ext --global-option="-I%GRAPHVIZPATH%\include" --global-option="-L%GRAPHVIZPATH%\lib" pygraphviz

In the above, we provide pip with the location of the include files and the library files. Note that it shows that I had graphviz installed at C:\Applications\Graphviz\Graphviz2.50, which should be adjusted according to your set up.