Installing Python modules for OpenERP 6.1 in Windows - python

I installed OpenERP 6.1 on windows using the AllInOne package. I did NOT install Python separately. Apparently OpenERP folders already contain the required python executables.
Now when I try to install certain addons, I usually come across requirements to install certain python modules. E.g. to install Jasper_Server, I need to install http2, pypdf and python-dime.
As there is no separate Python installation, there is no C:\Python or anything like that. Where and how do I install these python packages so that I am able to install the addon?
Thanks

Please check this link, may be helpful for you.
http://www.zbeanztech.com/blog/openerp-source-eclipse-under-windows
if you install the python package separately, then you have to add the bin path of the installed package to the system environment variable.

Good question..
Openerp on windows uses a dll for python (python26.dll in /Server/server of the openerp folder in program files). It looks like all the extra libraries are in the same folder, so you should be able to download the extra libraries to that folder and restart the service. (I usually stop the service and run it manually from the command line - its easier to see if there are any errors etc while debugging)
Let us know if you get it working!

Related

Create package with dependencies

Do you know how to create package from my python application to be installable on Windows without internet connection? I want, for example, to create tar.gz file with my python script and all dependencies. Then install such package on windows machine with python3.7 already installed. I tried setuptools but i don't see possibility to include dependencies. Can you help me?
Their are several Java tutorials on how to make installers that are offline. You have your python project and just use a preprogrammed Java installer to then put all of the 'goodies' inside of. Then you have an installer for windows. And its an executable.

Do others need to have the same modules installed to run my code in Python?

If I use a module such as tkinter, would somebody need to have that module installed as well in order for my code to run on their machine?
Definitely. You can use virtual environments or containers to deliver required packages or have a requrements.txt or similar to install the dependencies.
python comes with a number of standard modules pre-installed, if the other person is running python (the same version of you) then he/she won't need to install anything, it will just work, that's the case of tkinter. But if you use external packages that you installed to run your code, for example celery, then he/she will need to do the same thing.
If you gave your code to someone to run, they would need to download the same modules, unless you also sent the environment too. The only way I know around this is to freeze your code where you would create an executable. I've used cx_Freeze and pyInstaller and haven't had any issues but it also depends on your needs. You can find some more information through here:
https://docs.python-guide.org/shipping/freezing/
Hope this helps!
In your running environment do a, this file you add to your repo
pip freeze > requirements.txt
When people clone your repo, they only have to do a:
pip install -r requirements.txt
and they will install exactly the same pypi modules you have.
With virtualenv you can isolate a python environment to each project, with pyenv you can use different pythonversions withing the various environment also.

Why install Python packages

Why we have to install the python packages before using them?
I am currently working on a small python mysql program. What i tried to download the python connector module from mysql webpage and simply unzip it and place it in the same folder of my code.
And I can import the module properly.
So what is the meaning of installing those packages? Can I use those packages like matplotlib, numpy without installing them ?
Is it possible to have all the required packages installed on a folder so that i can move it to another computer and run my program with only CPython installed (I don't want to install any package on this computer)?
it's not that simple :-)
some packages have dependencies, you also need to download and extract their dependencies (you need pacakge x,and package x uses y) pakcage manager handles that
some package have some c code (they need to be compiled before use (ujson or postgres module) package manager handles that
when your share your code instead of sharing dependencies you simply add a file containing the list of dependencies (requirements.txt) and other user can simply install all dependencies using package manager
Installing a python package enables us to use it anywhere on our system. If we just place the package in the same directory as our script then it may well work, but only for scripts in that directory.
Some packages also rely on others to function properly, and the installation of a package may well install those pre-requisite packages for you. You may be able to do this manually, but you'd have to put them all in the same directory as your script every time you wanted to run it.
So installing the packages is the easiest way to use them.
You don't have to install them, and in some cases you wouldn't install them on your system; if you had split your code across two files and imported one file at the top of the other for example.
In fact, you don't really need install package on your system.
But if you install it, you can use these packages every where on your system.
Also, you can create a requirement.txt file to enable install all packages that you need on other computer. You can check this manual https://pip.pypa.io/en/stable/user_guide/#requirements-files

Importing libraries

I have a general question using third party libraries, but I will exemplify it on two examples to make it clearer and more "answerable":
I want to use pyfmi in Python. Trying to install it through pip tells me:
"Exception: FMI Library cannot be found. Please specify its location, either using the flag to the setup script '--fmil-home' or specify it using the environment variable FMIL_HOME."
I figured out that I had to download the tar.gz from jmodelica.org and extract the files, create a build directory, use cmake, make and make install commands. All runs through without a hitch. But trying to install through pip gives me the same error message. So my question is:
How does one do this? Do they mean by setup script the setup.py file? How can I access that one if I am installing through pip?
An which one is the fmi home directory? Is it the untarred file in my Downloads-Folder or one of the files in it:
builddir
Config.cmake
install
src
Test
ThirdParty
CMakeLists.txt
FMILIB_Acknowledgements.txt
FMILIB_License.txt
FMILIB_Readme.txt
LICENSE.md
README.md
? What is that flag and where to put it "exactly".
Thanks a lot.
PyFMI requires (as noted on the PyPI site) that FMI Library is installed prior to trying to install PyFMI from source.
During the installation (invoking python setup.py install) of PyFMI, the environment variable "FMIL_HOME" is checked to see if that points to an installation of FMI Library, if so, this will be used during the installation. So in your case, you need to set this environment variable. The other option is to install manually (using python setup.py install --fmil-home="/path/to/fmil") where the added path should point to FMI Library.
The third option is to see if there are binary installers for your platform (these include FMIL). Check PyPI, Anaconda and Christoph Gohlke's site.

Unable to use downloaded third-party library from within PyCharm

I'm working on a script that will plot data onto a map using the Basemap library. I'm trying to import Shapely as well for use in this same script. I'm working with Anaconda2 for Python2.7 in a Windows 7 environment. I used conda install to download the tar.bz2 file from the Conda Packages site (using Windows command line) and it looked like it all installed correctly.
When I open Pycharm and look at my accessible site-packages, I can see this package. However, when I try to use it within my script, I get an error saying that the package does not exist. I ran the script through the debugger to see if it would shed any more light, but I got the same error. Here's a screenshot of my available site packages when I go to Settings-->Project Interpreter from within Pycharm.
Screenshot of PyCharm site packages available
Is there something special I need to do in order to access this package from within a fresh Python file? I was trying to say "import shapely" or "import osx-64-shapely", but both give me the same "package does not exist" error message. I've been able to successfully use other third-party libraries within Python, so I'm not quite sure what the error is here....
I'm new to SO - if you need more details or there's some piece of info I didn't include, please let me know. Thank you for your help!
EDIT: I am NOT asking what the difference is between conda and pip, or how to use pip within PyCharm. I have used both successfully before to install third-party libraries. What I am asking is what might cause a third-party library that appears to have installed successfully from the command line become inaccessible from within PyCharm when I attempt to import it.
I'm not familiar with Shapely but I was astonished to see the name osx-64-shapely as a site-package for your python installation which is in windows 7. Are you sure you downloaded the right file? :)

Categories