Install gdcm without conda - python

I want to install gdcm on linux. Based on the instructions (https://anaconda.org/clinicalgraphics/gdcm), I have to use:
conda install -c clinicalgraphics gdcm
However, I can not use conda install because I should not use Anaconda for some reasons. So, how can I install gdcm?

The problem is that you've gone to the Anaconda page for gdcm, instead of to the project's homepage. Of course the Anaconda page tells you how to install it for Anaconda. But it's got a link to the homepage right there near the top:
Home: https://sourceforge.net/p/gdcm/gdcm/
If you follow the link, the readme refers you to an INSTALL.TXT file, which starts off with:
See the wiki page at:
http://gdcm.sourceforge.net/wiki/index.php/Getting_Started
If you are reading this file, it certainly means you do not know how to build GDCM. See:
http://gdcm.sourceforge.net/wiki/index.php/Configuring_and_Building
It's pretty clear that this is a C library that has bindings for a bunch of languages, not a Python library. So, if you're not on a platform that has pre-built packages for it (it looks like that's only Debian and Ubuntu linux), you'll have to have a bunch of prereqs that you don't usually need for Python, but the directions look pretty easy to follow.

You can compile it from the scratch.
First step, you download from the website https://sourceforge.net/p/gdcm/gdcm/
Next step, it's done with CMake command

I found using pip install python-gdcm from https://pypi.org/project/python-gdcm/ as a working replacement for the conda install.

Related

Editing a python package

The question is really simple:
I have a python package installed using pip3 and I'd like to tweak it a little to perform some computations. I've read (and it seems logical) that is very discouraged to not to edit the installed modules. Thus, how can I do this once I downloaded the whole project folder to my computer? Is there any way to, once edited this source code install it with another name? How can I avoid mixing things up?
Thanks!
You can install the package from its source code, instead of PyPi.
Download the source code - do a git clone <package-git-url> of the package
Instead of pip install <package>, install with pip install -e <package-directory-path>
Change code in the source code, and it will be picked up automatically.

Matplotlib installation for python 3.6. and windows 8

I do not understand exactly what I should do to install Matplotlib. I read a lot of posts but I do not have so much of fluent knowledge in programming so basically all of this that i read is quite confusing. Does anyone know what exactly should be done when having Python 3.6., visual code studio and Windows 8 to install Matplotlib?
A way that is simple using the original python from python.org with PATH installed is to use pip. You can check by opening cmd and entering python. If it is not a recognised command then you will have to reinstall python but make sure to tick the box at the start to enable PATH. once this is done you can install packages such as numpy and matplotlib.
In cmd type pip install Then the package you want to install from the PyPI website and using the EXACT name in the url before the version number. It should be like: /PACKAGE/VERSION.
eg. for matplotlib the url is /matplotlib/VERSION, so the name would be matplotlib. To install the latest version pip install matplotlib
If for some reason you want to uninstall a package you would do: pip uninstall PACKAGE. To install a specific version use pip install PACKAGE==VERSION where VERSION is the exact version name in the url. For full documentation visit Packaging Help.
Visual code studio is not necessary in this situation. This question is too broad and asking for a recommendation on software. Because of this, I went with the original python installation way and not any 3rd party software.

Installing librdkafka on Windows to support Python development

A little background: I am working on some python modules that other developers on our team will use. A common theme of each module is that one or more messages will be published to Kafka. We intend at this time to use the Confluent Kafka client. We are pretty new to python development in our organization -- we have traditionally been a .NET shop.
The complication: while the code that we create will run on Linux (rhel 7), most of the developers will do their work on Windows.
So we need the librdkafka C library compiled on each developer machine (which has dependencies of its own, one of which is OpenSSL). Then a pip install of confluent-kafka should just work, which means a pip install of our package will work. Theoretically.
To start I did the install on my Linux laptop (Arch). I knew I already had OpenSSL and the other zip lib dependencies available, so this process was painless:
git clone librdkafka repo
configure, make and install per the README
pip install confluent-kafka
done
The install of librdkafka went into /usr/local:
/usr/local/lib/librdkafka.a
/usr/local/lib/librdkafka++.a
/usr/local/lib/librdkafka.so -> librdkafka.so.l
/usr/local/lib/librdkafka++.so -> librdkafka++.so.l
/usr/local/lib/librdkafka.so.l
/usr/local/lib/librdkafka++.so.l
/usr/local/lib/pkgconfig/rdkafka.pc
/usr/local/lib/pkgconfig/rdkafka++.pc
/usr/local/include/librdkafka/rdkafkacpp.h
/usr/local/include/librdkafka/rdkafka.h
Now the painful part, making it work on Windows:
install precompiled OpenSSL
git clone librdkafka repo
open in VS2015
install libz via NuGet
build solution
install to where???
This is where I'm stuck. What would a standard install on a Windows 7/8/10 machine look like?
I have the following from the build output, but no idea what should go where in order to make the pip install confluent-kafka "just work":
/librdkafka/win32/Release/librdkafka.dll
/librdkafka/win32/Release/librdkafka.exp
/librdkafka/win32/Release/librdkafka.lib
/librdkafka/win32/Release/librdkafkacpp.dll
/librdkafka/win32/Release/librdkafkacpp.exp
/librdkafka/win32/Release/librdkafkacpp.lib
/librdkafka/win32/Release/zlib.dll
<and the .h files back in the src>
Any recommendations on an install location?
I'm not sure where the ideal place to install on Windows would be, but I ran the following test with some success.
I copied my output and headers to C:\test\lib and C:\test\include, then ran a pip install with the following options:
pip install --global-option=build_ext --global-option="-LC:\test\lib" --global-option="-IC:\test\include" confluent-kafka
Unfortunately, this doesn't quite work because the confluent-kafka setup does not support Windows at this time: https://github.com/confluentinc/confluent-kafka-python/issues/52#issuecomment-252098462
It's an old question but seems still no easy answer yet. Also Confluent seems too busy to work on Windows supporting...
I had the same headache couple weeks ago and after some research, I managed to make it work for me on Windows. I logged my finding and uploaded a pre-compiled library to my Git, please check and see if it helps. :D
https://github.com/MichaelZhangCA/confluent-kafka-python
My environment is Python 3.6 64 bit version but ideally, it should also work for 32 bit if you follow the same approach.
I assume you have successfully followed instructions from MichaelZhangCA (https://github.com/MichaelZhangCA/confluent-kafka-python/) from previous post.
If you did so, these probably were the last two commands executed:
::Install confluent-kafka
cd C:\confluent-kafka-python\confluent-kafka-python-0.11.4
python setup.py install
If that is correct, those DLLs were created under C:\confluent-kafka-python\librdkafka-reference\release\.
All you have to do is to copy them to a diretory already in Widnows' PATH.
For example, I use Anaconda 5.2 For Windows, with python 3.6. My Anaconda Prompt has an empty directory in PATH, so I copied there those DLL's:
::Anaconda Prompt - copy DLLs to a directory already in PATH
mkdir %CONDA_PREFIX%\Library\usr\bin
copy C:\confluent-kafka-python\librdkafka-reference\release %CONDA_PREFIX%\Library\usr\bin
If you don't use Anaconda, just copy those DLL's to any other directory in Windows' PATH. You may also leave them in C:\confluent-kafka-python\librdkafka-reference\release, and add this directory to PATH.

Installing shapefile / shapelib not found via conda or pip

I am trying to read shapefiles to view suburbs in a city following this tutorial using windows 8, Anaconda and iPython.
I tried "conda install shapefile" and "pip install shapefile" in command prompt, both returning "Error: No packages found matching: shapefile".
Besides that I tried adding it manually following these links [1]How to import a module given the full path?
[2]Import python module NOT on path. However I am getting permission errors which suggests I am not importing them correctly anyway.
Any suggestions on how to proceed or best practices are appreciated.
try
pip install pyshp
in your cmd.
that is the name of you library as far as I can see, see https://pypi.python.org/pypi/pyshp
conda only works for these http://docs.continuum.io/anaconda/pkgs.html packages.
For the ones not in the list you need to use pip install. It can be confusing as the name of the library on pypi (this is where pip goes to download it) is often, but not always the same as the import name, so if conda and pip don't work, first try to google to make 100% sure that your library is not on pypi, because most respectable libraries are...

Installing Pypotrace for python?

Did anybody manage to install pypotrace or is able to install mingwin it's like mission impossible for me I've passed the last 12 hours trying to found out how but nothing is working and description are poor please could any body help? This is where you can get it:
pypotrace web site
This problem was so much of a pain that I ported potrace to python directly rather than using hooks and requiring local compile.
pip install potracer
https://github.com/tatarize/potrace
I implemented the same API as pypotrace so it should be fairly painless.
Since you are working in windows you need the following steps:
You may need the python distutils package - pip install -U distuilts should do the job.
You will also need Cython - the windows installers are here.
You need to install mingw and make sure it is working in
msys mode - run msys and you should get a command prompt in it type
gcc --version and make sure you get a sensible reply.
also make sure your python runs from within msys
Do the required downloads:
potrace source,
agg source site broken or the GitHub zip file here,
potrace source from here and unzip it.
The follow the instructions at the link you gave and tell us where they stop working.

Categories

Resources