Installing Graphviz on windows 10 - python-3.x

I'm trying to install graphviz on windows 10 (Python 3.6). I went through multiple documentations but nothing seems to work. I tried to run below commands which were explained in the various documentations but it didn't work.
install -c anaconda graphviz
conda install -c anaconda graphviz #I tried these commands in python console
I get below error:
Syntax Error : invalid syntax
Can anyone tell me the exact procedure of installing graphviz on windows?

pip install graphviz didn't work for me. The library could be imported, but when I tried to open real-world examples, it crashed because of missed dependencies. (I actually found this topic while trying to solve those crashes lol).
The following two commands solved all my problems:
conda install graphviz
conda install python-graphviz
I am now able to replicate all the (graphviz) plots presented in this well-known Machine Learning repository:
https://github.com/quark0/darts
PS. Perhaps executing only the second command (alone) is enough (conda install python-graphviz), I am not 100% sure. I only know that conda install graphviz doesn't work alone for Python.

You should first install graphviz. http://www.graphviz.org/download/
After installing it and adding to path installing the python bindings should be straight forward.
pip install graphviz
edit: Updated the link

Related

How do I "build with the CLI option" with conda-build?

I am new to Python, the Anaconda environment, conda, pip, all of it, so please bear with me if these are simple questions. I've asked a couple previous questions about this install which so far have been resolved. Here was my previous question. All of my issues have to do with conda-build meta files which don't work and need some hand-editing in order to succeed.
Background:
I am trying to install the package called ibm-watson in my Python, in a separate conda environment cloned from my base environment. This is in support of a Coursera course. The courseware builds this package in its own Jupyter window with a pip install. I wanted to build the examples in my own environment, and I'm working in Anaconda at the recommendation of many people.
When I first ran into issues with conda-build which I couldn't figure out, I decided to try pip. That worked, but led to other problems (which online articles warned about). Conda (I read) doesn't know about things installed with pip, and that screws up its ability to manage packages and environments. So I decided to back out the pip install and try to make it work with conda.
First question: Why does pip install work correctly and recursively build all dependencies but conda-build does not? Am I just not using the right options for conda?
So here are the meta.yaml issues I've uncovered so far and resolved with the help of people here.
Version string that said '>=2.0,' with an extraneous comma.
package name that was shown with underscores but actually needed hyphens
Dependencies which I fixed by downloading the required packages one by one and building, frequently dealing with the same issues above in the meta.yaml
Most recently, this string, which was throwing an error till I guessed that the quote marks were the issue: typing; # [ py <'3.5' ]
Also the install command from the conda documentation conda install --use-local my-package doesn't work, and per a discussion on Github, I am instead using conda install -c ${CONDA_PREFIX}/conda-bld/my-package
Second question: Why is the conda process so buggy? Are the IBM developers just careless in their testing or is it conda that's at fault or am I using all of this wrong?
And finally, the real question
The last dependency I had to build was python-dotenv installed from PyPi. I built that with conda like the others:
conda skeleton pypi python-dotenv
conda-build python-dotenv (after making the above change to meta.yaml)
That gets all the way through building but then throws this error:
Run pip install "python-dotenv[cli]" to fix this.Tests failed for python-dotenv-0.11.0-py37_0.tar.bz2 - moving package to /Users/(myname)/opt/anaconda3/envs/coursera/conda-bld/broken
Since I'm not using pip, how do I do what it's asking me to do? I tried just doing conda-build "python-dotenv[cli]" but got "no valid recipes for python-dotenv[cli]".

poetry and python version errors when upgrading from python 2.7 to 3.7

I have started a learning effort to teach myself python. The project started on my mac with python 2.7 as the installed version. On the advice from a friend, I installed poetry to do dependency handling. This worked extremely well.
Before long though I realized how out of date python 2.7 was and tried to upgrade. I did so through homebrew and that seemed to break a lot. python --versoin still shows 2.7 and although I can call python3 --version and see the correct my project still seems to be stuck on 2.7 even when #!/usr/bin/env python3 is at the top of the files. To make matters worse doing a poetry up won't upgrade my python dependency in the project and changing that value in the pyproject.toml brakes everything. I have a dependency that seems to have broken along the way but can't do anything about it with broken poetry/python version mess. The error is below from the poetry.
So taking this from the top how do I get things to start using the correct version of python?
My bash_profile has
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
poetry install
[EnvCommandError]
Command ['/Users/username/Library/Caches/pypoetry/virtualenvs/PyGameEngine-py2.7/bin/python', '-'] errored with the following return code -6, and output:
dyld: Library not loaded: #executable_path/../.Python
Referenced from: /Users/username/Library/Caches/pypoetry/virtualenvs/PyGameEngine-py2.7/bin/python
Reason: image not found
input was : import sys
if hasattr(sys, "real_prefix"):
print(sys.real_prefix)
elif hasattr(sys, "base_prefix"):
print(sys.base_prefix)
else:
print(sys.prefix)
Copying my answer from here
Interestingly, poetry is silently failing due to a missing package the tool itself relies on and continues to install a broken venv. Here's how you fix it.
sudo apt install python3-venv
poetry env remove python3
poetry install
I had to remove pytest, and then reinstall with poetry add pytest.
EDIT: I ran into this issue again when upgrading a project from python3.7 to python3.8 - for this instead of installing python3-venv, you'd want to install python3.8-venv instead
If you are still having issues ( namely upgrading your packages to be python3 compliant, you may want to take a look at this answer )

installation of assimulo and sundials - error

I want to use Assimulo and Sundials for the solution of differential algebraic equations in Python and therefore I am trying to install it on Ubuntu.
For the installation of Sundials, I followed the installation instructions and as I understand it worked well.
% cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lib/sundials-3.1.1/ ~/opt/sundials/sundials-3.1.1
% make
% make install
Then I tried to install Assimulo with the command pip3 install Assimulo, but I get an error message. I also tried to follow the instructions on Installation - Assimulo 3.0 documentation by downloading the installation files and install it with the following command. It results in the same error message.
sudo python3 setup.py install --sundials-home=/usr/local/lib/sundials-3.1.1
This is the error message I get:
target build/src.linux-x86_64-3.6/assimulo/thirdparty/hairer/dopri5module.c does not exist:
Assuming dopri5module.c was generated with "build_src --inplace" command.
error: 'assimulo/thirdparty/hairer/dopri5module.c' missing
What is wrong and how can I fix it? Any help would be appreciated!
I got the same error when installing on macos via pip install assimulo, after pip-installing numpy and cython.
For me, using a conda env did the trick:
Creating the conda env: conda create -n your_name_goes_here
conda activate your_name_goes_here
conda install python=3.6 (I noticed you can also use 3.7)
conda install -c conda-forge assimulo
I also had the same error message. As suggested in the other answer, you can get a compiled package from Conda. But if you want to compile from source yourself, it looks to me that PyPI source tarball doesn't contain all needed files. At least some *.pyf files are missing. So, I used SVN repo instead:
svn checkout https://svn.jmodelica.org/assimulo/tags/Assimulo-3.0/ assimulo
By compiling this source tree, I managed to get pass the original error you had, but I'm now having another build error that I don't know yet how to solve:
ssimulo/solvers/sundials.c: In function '__pyx_f_8assimulo_7solvers_8sundials_5CVode_initialize_cvode':
assimulo/solvers/sundials.c:33274:31: error: too many arguments to function 'CVodeCreate'
__pyx_v_self->cvode_mem = CVodeCreate(__pyx_t_3, __pyx_t_4);

pygraphviz multiple edges from the same node aren't working on Mac OS X

I installed dependencies like this.
brew install python
brew install graphviz
pip3 install --user --install-option="--include-path=/usr/local/include/" --install-option="--library-path=/usr/local/lib/" pygraphviz
After that I tried a simple script (copy-pasted from somewhere in the internet). Multiple edges simply are not working! I set strict=False, but it didn't help.
import pygraphviz as pgv
G=pgv.AGraph(strict=False)
G.add_node('a')
G.add_node('b')
G.layout()
G.add_edge('a','b','first')
G.add_edge('a','b','second')
sorted(G.edges(keys=True))
G.draw('file.png')
Everytime I execute this script, what I got is this.
What am I doing wrong?
brew install graphviz --HEAD which installs version graphviz: stable 2.40.1 (bottled), HEAD resolves problem for me.
Other have reported that this issue is bug #162, but it seems to be different problem.

PyMesh Installation on Python 3.6 Windows

I am trying to install Pymesh on Python 3.6.
In my first try, I installed through pip, however it installed a wrong PyMesh than I wanted.
It installed the following, https://pypi.org/project/pymesh/, while I wanted https://pymesh.readthedocs.io/en/latest/
I uninstalled it, and tried installing the later PyMesh, however no luck. There were no instructions for windows. I downloaded the source from github. I extracted and pasted it in C:\Python36\Lib\site-packages
Then I ran python3 setup.py build - when an error showed up, I also tried python3 setup.py install, which worked. However, I am unable to do a simple basic command mentioned in the web page: https://pymesh.readthedocs.io/en/latest/basic.html
It is saying pymesh does not have module name load_mesh.
Looking for the process or thoughts on how to properly install pyMesh for Windows.
My go to solution for problems like this on Windows is always to try it in a conda env first. If that fails, use Docker.

Resources