Cascade dependencies when add python packages to my app libraries - python-2.7

I'm trying to add python packages to my Choregraphe app because some packages that are installed by default with python 2.7 aren't in python embedded in Choregraphe.
I want to add urllib3 and certifi to my app to be able to sen HTTPS requests and verify SSL certificates.
So I added a lib folder to my app with the necessary packages, it works fine for urllib3 but to verify SSL certificates I got a cascade of dependencies so I don't manage to do what I want.
Does anyone know if there is a way to access manually the default python version accessible by my Robot so that I can send my request with these packages ?
Thanks in advance !

If you're running this on a Pepper with NAOqi 2.5, pip is installed on the robot; though you'll need to upgrade it:
pip install --user --upgrade pip
and then you can run
/home/nao/.local/bin/pip install --user urllib3 certifi
Then you don't need to package those files in your choregraphe package.
It won't work on the virtual robot (but then you can just add the real path of those libraries to sys.path), and it means you'll have to do this procedure yourself if you want to install your app on a new robot, which can be a hassle.

Related

Linux python django site-packages not recognized in envelope

I have tried to create envelope on my linux pop os system using miniconda. When I activate it, I can install packages using pip, but when I run my django instance it doesn't find the modules.
If I type which python is shows the miniconda path correctly. I can look in the site-packages folder and see the packages installed.
I've tried installing django-anymail and corsheaders and they are both not being found. It does find my locally installed apps.
If I use the command line and open python and then import, it does not recognize my modules installed in the virtual envelope either. I thought it was a problem with conda, so I also created an envelope using python's native method: python3 -m venv
I have the same problem with it finding pip install site-packages.
Is there a command I can run to show all available packages?
I hadn't realized I had aliased my python. Now it is working.

Moving django project to Github removes its dependency packages

So I'm working on a blog right now with Django and Python. I created a virtual environment and created my project there. I activated my virtual environment every time, so that whenever I do pip install Django or whatever it installs those packages to my virtual environment. However, When I uploaded my project with virtual env to GitHub and downloaded it on my laptop, and do "pip list" only 4 Django packages(pip, pytz, setuptools, virtualenv) are there. They are all different versions from the original too. My original virtual env has these packages below:
certifi 2018.11.29
chardet 3.0.4
Django 2.1.5
django-embed-video 1.2.0
idna 2.8
pip 18.1
pytz 2018.7
requests 2.21.0
setuptools 40.6.3
urllib3 1.24.1
wheel 0.32.3
Can anyone explain to me what is going on?
When you setup your python project with virtualenv, it install your third party packages on your local machine. That means whenever you copy or clone your repo from github to other machine you have to install all the packages again to run.
To know more about virtulenv please refer to this awesome tutorial.
If you want to build your django project machine independent then I guess Docker is your best bet.

Check if package available in python3

I have a project in Python2.7 and want to port it to Python3.6.
I want to build some kind of dependency tree where I can see which package is available in Python3.6. But don't know why how to check it without trying to install it to Python3.6 environment.
For example: boto-rsync is not available for Python3.6, but redis do.
And I need some advice where to start.
Use pip freeze in your both python2 and python3 environments and redirect them to a text files to see what all packages are installed.
Example:
pip freeze >> python2.txt
Click here for pip documentation.

Install python modules on MAMP

I am trying to install the oauth2 python module on MAMP but am not sure how to do it properly. I have tried using pip install but it installs the package in the root system and not in MAMP directory. Is there an easy way to do this? Thanks.

Is it possible to install a django package without pip?

I am trying to install django-dash to run one of the dashboard examples and see what it's like.
I am on Windows running Python 2.7 and Django 1.6.5. I know the usual approach is to download pip then install the package using pip. However, I am on a work computer with no administrative rights so I can't access my Internet Option Settings to find my proxy URL to follow the instructions below:
Proxy problems
If you work in an office, you might be behind a HTTP proxy. If so, set the environment variables http_proxy and https_proxy. Most Python applications (and other free software) respect these. Example syntax:
http://proxy_url:port
http://username:password#proxy_url:port
I had the same issue when trying to install Django but was able to get it to work by moving the django directory under Python27/Lib/site-packages. Is there something similar I can do with django-dash?
I also tried downloading the sources and running python setup.py install. I received the following error:
File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools
Link to django-dash: http://django-dash.readthedocs.org/en/latest/
Yes, you can probably get the sources from The Python Package Index
Once you have them, uncompress the files and install them manually (this will depend on you OS).
On Linux systems:
python setup.py build
python setup.py install
Here's the full reference
EDIT : Note that when manually installing those packages, you must also install any missing dependencies, eg. setuptools in your case