I am trying to install via pip install a python module. But when I do it, it gives me this:
RuntimeError: Required library Boost not found.
Now, I have already downloaded boost. I put it in program files/boost (hopefully that is how it's done because the boost web page doesn't give much detail on the installation except to download and extract). So I am not sure what the problem is. I have tried to do cd program files/boost, but that doesn't work either. The instruction from the documentation is pretty vague too.
First time I am doing this, so I can't tell if what I am doing is dreadfully wrong or not.
Now, I have already downloaded boost. I put it in program files/boost (hopefully that is how it's done because the boost web page doesn't give much detail on the installation except to download and extract)
No, that's not how it's done, and that's your problem.
Also, I don't know where you got the idea that the Boost web page doesn't give much detail on installation. There's a huge Getting Started document.
Of course that documentation tells you how to build C++ programs that you're writing against Boost; it doesn't tell you how to convince Python to find it for modules that depend on Boost.Python. That's in the Boost.Python docs.
Also note that Christoph Gohlke's unofficial Windows Python Binaries includes a boost.python package, which installs all the Python-side runtime stuff for you, which makes it a bit easier.
This isn't simple. (It's a lot simpler on Unix systems (including Macs), where, as long as you install a C or C++ library into some standard path, every other program can find it.) But I doubt anyone is going to be able to provide a better tutorial in a StackOverflow answer than the one in the official docs, so you're just going to have to read them.
Related
I would like to be able to use the services that the Blockcypher module provides for my programme, however i have (at least i think) downloaded the correct module package but cant get it to integrate with my Python on my Computer. I am fairly new to python so I have no idea on where to even start tackling this problem.
Modules, regardless of where you've got hold of them, will be searched for in the sys.path. If nothing is found there, they will be looked up in the current directory.
When you download some code directly it will be a good first guess to place it in the directory of the script from where you are using the download. If it's just a .py-file, place it there. If it's an archive with a directory, then place the directory there (not the files).
Generally, you should prefer installing modules via a package manager such as pip or conda. Such package managers take care of placing modules properly for usage with your Python installation from wherever you will write your script. They also provide support for updating these modules to newer versions later.
Update: If you cannot make anything from this remarks, you should first read the section on modules in the Python tutorial, or even work thru the full tutorial or thru a good book (or any other ;) to get a smooth entry into the friendly world of Python programming.
Update (2023): The Dive Into Python link above is outdated, so here is the updated link to this great resource:
https://diveintopython3.problemsolving.io
I think it's still the best beginner's resource, but, well, here are many more:
https://wiki.python.org/moin/IntroductoryBooks
So I have a Python package – it’s all set up on PyPI, and on GitHub, no problem. This is something I’m relatively familiar with.
What is unknown to me is: the notion of installing a CMake script as part of the python package install process. The python package in question is a development tool – you use it to preprocess some of your C/C++/Obj-C/Obj-C++ source files and generate some predefined macros in a header – and it works well when it’s wrapped in a CMake macro (for example like so) and executed as part of a proper chain of dependencies.
For one, I am not sure how to approach this, as there seem to be significant differences between the setuptools sandbox stance and distutils’ willing systems-level installer integration – and then even if I did know how to go about setting things up correctly in setup.py, I can’t find a good precedent on where a CMake script pertaining to a Python package might live.
All thoughts and insights on the matter are welcome.
It took me a while to understand your question. If I understand correctly, what you are trying to do is provide the IodSymbolize.cmake in the standard installation location of cmake so that other users/projects who rely on your software(symbolizer) can use it in their build process. I think you are thinking in a good direction, trying to provide services for end users of your package. Good question!
Here is my understanding of how things work in the cmake world.
Say I am an end user who wants to use "symbolizer" executable. What I would do is
find_package(symbolizer). This would try to figure out the location of the executable and it would set certain variables which can be used in the build process.
You need to provide Findsymbolizer.cmake file.
Please take a look at : http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
Also look at the Find*.cmake files provided in /usr//share/cmake/Modules directory if you are Unix/Linux platform.
Once the Findsymbolizer.cmake file is working properly, send it to the cmake mailing list for review. Once accepted it can be packaged in the next release of cmake. Then your module is usable with cmake. Hope I answered your question. Please update if you need more info.
I've just built a Jython project that uses both some Python module imports and some Java jars. On my own computer, since I just wanted the thing done, I've gotten things to work in a very hacky way by hardcoding sys.path and installing every module and jar I wanted separately. This is definitely not something I want to keep for a release version. I've read about being able to package everything up into one standalone Jython jar, and that sounds pretty good to me. Is there any reason I shouldn't do this? If not, is there a guide on the best way to do this someone can point me to? I'm running the whole thing through PIG, so having a callable Jython jar would be ideal.
I know some similar questions to this already exist on SO, but the answers to those seem pretty old, and the documentation given (for MavenJython, for example) is pretty poor. I've already looked at MavenJython, and Jip, but I can't really decide between the two, and I'm not really finding sufficient information for either. An ideal answer to this question what I should use, why I should use it, and give a brief demo of how one would use it. A link to any of those would also be awesome.
Thanks!
Please elaborate on how the MavenJython documentation can be improved. Things have not changed since 2011 (you probably have seen this answer), which is not that long ago. There is the website, but as a programmer you probably just want to read the source code of the jython-compile-maven-plugin-test project, which is only 200 lines of code. It is a good idea to use this package as a starting point for your own project.
Distribution philosophies
The way Java software distribution (and Windows software distribution) usually works is that you package everything you need. So yes, a standalone Jython jar would be appropriate. The drawback is that every software may use a different Jython version, the benefit being that this might be what you want (updates may break things). This is the MavenJython approach too, packaging everything in the correct versions.
Python and Linux software distribution just installs packages, checking compatibility at install time. This is the jip approach, which assumes you already have Jython, and whoever installs software will resolve compability issues by installing the correct versions.
Differences
I can not say much about jip though, I have not used it. From what I see in the demos jip is meant to provide Python packages access to Maven Java libraries. It also seems to be capable of producing maven packages from Jython code. So you can probably achieve your goal using either MavenJython or jip. Just try.
The deliverables built using MavenJython distribute Jython, while jip does not.
If you want to instruct programmers who already use jython and are unfamiliar with Maven, who want to use your library to fetch your jython library package, jip might be the way to go.
If you want to write Jython libraries for programmers and distribute them, you can use either MavenJython or jip.
If you have a software package that is going to end up as a deliverable to customers, which happens to also use Jython code and Jython packages, perhaps also providing in-program scripting to the user, go with MavenJython. It allows you to create a standalone executable.
Pig use case
For running jython through pig it is enough to install jython and put the jython sources in your path -- see the embed python section of the pig manual. jip can be appropriate for installing jython packages locally, but is not necessary if you only want to run your code. If you however want to distribute software which uses pig, and install pig, jython and your code on a clients computer, MavenJython can do that for you.
For quite some time now, I've been fighting in vain to get a software I'm working on to work under Windows. It's written in Python (the 2.x series), and although all Linux users can benefit from its GUI when they use the source package, it seems that many people who download it go for the Windows package, for which I've only been able to provide command-line binaries.
The GUI was built using Glade/GTK, and uses poppler to embed a PDF viewer. I've found various howto's in the past (I don't have them at hand right now, sorry), which I've tried to follow religiously, but I never got things to work at all.
So, is there a reliable tutorial explaining exactly how to install the needed libraries (GTK and Poppler), so that I can build the corresponding binaries for my users?
There is a window installer here: http://download.gnome.org/binaries/win32/pygtk/2.22/
I have started on a personal python application that runs on the desktop. I am using wxPython as a GUI toolkit. Should there be a demand for this type of application, I would possibly like to commercialize it.
I have no knowledge of deploying "real-life" Python applications, though I have used py2exe in the past with varied success. How would I obfuscate the code? Can I somehow deploy only the bytecode?
An ideal solution would not jeopardize my intellectual property (source code), would not require a direct installation of Python (though I'm sure it will need to have some embedded interpreter), and would be cross-platform (Windows, Mac, and Linux). Does anyone know of any tools or resources in this area?
Thanks.
You can distribute the compiled Python bytecode (.pyc files) instead of the source. You can't prevent decompilation in Python (or any other language, really). You could use an obfuscator like pyobfuscate to make it more annoying for competitors to decipher your decompiled source.
As Alex Martelli says in this thread, if you want to keep your code a secret, you shouldn't run it on other people's machines.
IIRC, the last time I used cx_Freeze it created a DLL for Windows that removed the necessity for a native Python installation. This is at least worth checking out.
Wow, there are a lot of questions in there:
It is possible to run the bytecode (.pyc) file directly from the Python interpreter, but I haven't seen any bytecode obfuscation tools available.
I'm not aware of any "all in one" deployment solution, but:
For Windows you could use NSIS(http://nsis.sourceforge.net/Main_Page). The problem here is that while OSX/*nix comes with python, Windows doesn't. If you're not willing to build a binary with py2exe, I'm not sure what the licensing issues would be surrounding distribution of the Python runtime environment (not to mention the technical ones).
You could package up the OS X distribution using the "bundle" format, and *NIX has it's own conventions for installing software-- typically a "make install" script.
Hope that was helpful.
Maybe IronPython can provide something for you? I bet those .exe/.dll-files can be pretty locked down. Not sure how such features work on mono, thus no idea how this works on Linux/OS X...
I have been using py2exe with good success on Windows. The code needs to be modified a bit so that the code analysis picks up all modules needed, but apart from that, it works.
As for Linux, there are several important distribution formats:
DEB (Debian, Ubuntu and other derivatives)
RPM (RedHat, Fedora, openSuSE)
DEBs aren't particularly difficult to make, especially when you're already using distutils/setuptools. Some hints are given in the policy document, examples for packaging Python applications can be found in the repository.
I don't have any experience with RPM, but I'm sure there are enough examples to be found.
Try to use scraZ obfuscator (http://scraZ.me).
This is obfuscator for bytecode, not for source code.
Free version have good, but not perfect obfuscation methods.
PRO version have very very strong protection for bytecode.
(after bytecode obfuscation a decompilation is impossible)