Python doesn't see a library graph_tool - python

I have installed the "graph-tool" library. I used am instruction from official site https://git.skewed.de/count0/graph-tool/wikis/installation-instructions (the option "Installation via package managers". I use Anaconda distributive (I included it in the PATH) instead of system version of Python. And there is a problem... When I use system python it sees this library but my Anaconda doesn't...
What should I do that my Anaconda will see it?
Thank you.

On Ubuntu you will, as far as I know, have to compile graph-tool from scratch in order for it to work correctly when using anaconda python.

Related

Use Python within MATLAB environment (2019a)

I have 2019a version of MATLAB and I am trying to explore the usage of Python from within MATLAB environment. I have Anaconda 3 installed for Python. In MATLAB, when I issue, pyenv, I get 'Undefined function or variable 'pyenv''
The documentation says that Python is supported, but I am not sure why this doesn't work. Any suggestions?
Edit:
Thanks. Solution is to use pyversion, but also set the path with the entire path
pyversion 'C:\Users\newuser\AppData\Local\Continuum\anaconda3\python.exe';
pyenv was introduced in R2019b. In R2019a and older, you need to use the older pyversion function.

Python: Where do I find packages like "gf" for the Anaconda Navigator and how do I install them? Python Version 3.6

this is my first question here;-)
I am using Python 3.6 via Anaconda Navigator (1.7) and that program shows a list of packages when I click Environments.
Are these packages directly useable or do I have to start any process therefor?
In a script I want to use the import-function for the package "gf", this one is not in the list above.
Where do I find it in a compatible form and how can I make it useable?
Anaconda says it has to be .yaml or .yml (Conda environment files) or .txt (Conda explicit specification files or pip requirement files)
I know the other way with the command line and WHL files, but Anaconda does not seem to have any command line as the kind-of-user-guide says.
First I tried renaming other install files to .txt, but Anaconda just took ages and got a serious problem that I had to restart it several times.
I also tried to check https://anaconda.org/conda-forge for "gf", but it seems not available there.
Best Regards
By GF, do you mean Grammatical Framework (https://www.grammaticalframework.org/)? If so, then you can't install it via Anaconda. Maybe you would be interested in one of the following options?
Jupyter kernel for GF
From https://github.com/kwarc/gf_kernel#readme:
gf_kernel is a Jupyter kernel for the Grammatical Framework (GF) . It allows you to write grammars and using them for parsing/translating/... all in one notebook, which makes it great for demos and teaching, but also for small experiments with GF.
You need to have GF installed: see https://www.grammaticalframework.org/download/index.html for options.
Using GF grammars from an external Python program
Python bindings to the PGF library are included in the GF binary, so if you have Mac or Ubuntu, the easiest way is to download the binary.
For other systems, see this blog post for how to install.

Can Python 2.5 and 2.7 coexist along with wxPython, py2exe and comtypes (try to resolve MSVCP90.dll problem)?

I was writing a code which uses wxPython and comtypes. I have python 2.7 installed on my machine (Windows) along with wxPython, comtypes and py2exe. while trying to build it I got the following error:
error: MSVCP90.dll: No such file or directory
So, I did research I came to know about two solutions:
1. Copy Microsoft.VC90.CRT.manifest and msvcp90.dll to your machine and prepare your setup like as follows:
from distutils.core import setup
import py2exe
from glob import glob
data_files=[("Microsoft.VC90.CRT", glob(r'c:\shared_dlls*.*'))]
setup(data_files=data_files, console=['main.pyw'])
2. Use Python 2.5 along with wxPython, comtypes and py2exe
Now, I have following questions:
In first case:
a. Do I need to have Visual Studio license in order to use these files? or that can be used without any worries.
b. What if I compile it using aforementioned method? Does it still require MSVC90.dll on the user machine to execute? I think - No. Please correct me if I'm wrong. I want to remove any dependency and give user an exe which the user can directly execute without any dependency.
In Second case:
As I have Python_2.7 installed on my machine along with aforementioned modules. I would like to know can I install Python 2.5 on the same machine? Can they co-exist? If yes, do I need to install another copy of wxPython, comtypes and py2exe for this.
Please suggest me what is the best solution. How should I proceed? It's kind of blocking me.
Thanks in advance!
Python 2.5 and 2.7 (and all other versions of Python) co-exist very well. You may need to change your path to use the correct version of Python.
You will need to install the Python 2.5 builds of wxPython and py2exe. You will also need to install comtypes for Python 2.5. That installer will detect your Python installations by checking the registry.
I simply downloaded MSVCP90.dll file from here: http://www.dllme.com/dll/files/msvcp90_dll.html
and then pasted it into Python27\DLLs. It worked after that.
Did you try to install Visual C++ redistribuables?
I think you don't need a VS license for this.

Where can i get OpenCV for python?

Where can i get OpenCV for python?What are the pre-requisites?? i tried to install opencv-python through synaptic package manager but Python says
No module named CVtypes
CVTypes is a third party implementation that essentially wraps python around objects written in C, the language that OpenCV is written in (along with C++). If you want to use that, you will have to download and install it separately, as it is not part of the standard repositories of Ubuntu's Synaptic package manager that I know of at this time (I assume you are on Ubuntu because you mentioned 'Synaptic', Ubuntu's package manager).
However, there is an official python interface for OpenCV that is included in the OpenCV SVN repository and build packages. When installing version 1.0 from the package manager in Ubuntu, the python modules will be installed in the following directory:
/usr/lib/pymodules/python2.6/opencv
Ensure that is part of your PYTHONPATH environment variable and you should be able to import the modules as such:
from opencv.cv import *
from opencv.highgui import *
OpenCV over time has accumulated numerous Python bindings, mostly due to the strange way arrays are represented in OpenCV (IMHO). Here is a short list:
PyOpenCV
Scikits Image
Ctypes OpenCV
SWIG OpenCV
Choose which one you want to use and keep it consistent and upto date. I personally prefer the classic WillowGarage version[listed last] over its fancier cousins since it has most development and test muscle behind it.
get it from here unofficial binary packages.
by the way, they provide unofficial packages for many other projects
Tried the official website? http://opencv.willowgarage.com/wiki/Welcome
check your openCV version. Version 2 needs a simple
import cv
you may have a look at the samples/python folder.
this webpage explains in great depth on the installation
http://opencvpython.blogspot.com/2012/05/install-opencv-in-windows-for-python.html
after the installation try out the samples provided by opencv\samples\python2

How do I find out what Python libraries are installed on my Mac?

I'm just starting out with Python, and have found out that I can import various libraries. How do I find out what libraries exist on my Mac that I can import? How do I find out what functions they include?
I seem to remember using some web server type thing to browse through local help files, but I may have imagined that!
From the Python REPL (the command-line interpreter / Read-Eval-Print-Loop), type help("modules") to see a list of all your available libs.
Then to see functions within a module, do help("posix"), for example. If you haven't imported the library yet, you have to put quotes around the library's name.
For the web server, you can run the pydoc module that is included in the python distribution as a script:
python /path/to/pydoc.py -p 1234
where 1234 is the port you want the server to run at. You can then visit http://localhost:1234/ and browse the documentation.
Every standard python distribution has these libraries, which cover most of what you will need in a project.
In case you need to find out if a library exists at runtime, you do it like this
try:
import ObscureModule
except ImportError:
print "you need to install ObscureModule"
sys.exit(1) # or something like that
You can install another library: yolk.
yolk is a python package manager and will show you everything you have added via pypi. But it will also show you site-packages added through whatever local package manager you run.
just run the Python interpeter and type the command
import "lib_name"
if it gives an error, you don't have the lib installed...else you are good to go
On Leopard, depending on the python package you're using and the version number, the modules can be found in /Library/Python:
/Library/Python/2.5/site-packages
or in /Library/Frameworks
/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages
(it could also be 3.0 or whatever version)...
I guess it is quite the same with Tiger
Considering that in every operating system most of python's packages are installed using 'pip' (see pip documentation) you can also use the command 'pip freeze' on a terminal to print a list of all the packages you have installed through it.
Other tools like 'homebrew' for macOS (used when for some reason you can't install a package using pip) have similar commands, in this specific case 'brew list'.

Categories

Resources