Unable to download distribution package for Django - django

I'm currently testing with a django web application using version 1.6 with a python version 3.4.1 and needs to install some packages here on my machine. Based from what I've observed we are currently connected to a proxy server which is why I'm having issues downloading some of it. Below are the actions that I've taken so far.
1) I've updated my http_proxy connection to http://innoproxy:8083/proxy.pac which is our current proxy connection.
2) Below is error that mostly occurs when I would install the South Package.
C:\Users\fx0.MANDAUE>pip install South
Downloading/unpacking South
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement South
Cleaning up...
No distributions at all found for South
Storing debug log for failure in C:\Users\fx0.MANDAUE\pip\pip.log
My question is, would it be possible for me to install that package without using the command prompt(manual download) or do I still lack some actions from my end for the downloading to work? I've already checked other possible solutions but so far to no avail. Thanks!

I'm in a similar situation behind my corporate proxy. You may first want to check whether your proxy is looking for authentication, in which case setting you connection string to http://username:password#proxyserver:port/ may help. In my case, however, our authentication relies on Windows Active Directory, which I've yet to overcome on my Linux box.
If all else fails, as in my case, you can manually download the source tar.bz (or similar compressed directory) from PyPI and use pip install path/to/source. This will mean manually downloading all dependencies and installing them the same way. It can be a pain, but it works.

Related

Is it possible to use lambda layers with zappa?

I want to deploy my wagtail (which is a CMS based on django) project onto an AWS lambda function. The best option seems to be using zappa.
Wagtail needs opencv installed to support all the features.
As you might know, just running pip install opencv-python is not enough because opencv needs some os level packages to be installed. So before running pip install opencv-python one has to install some packages on the Amazon Linux in which the lambda environment is running. (yum install ...)
The only solution that came to my mind is using lambda layers to properly install opencv.
But I'm not sure whether it's possible to use lambda layers with projects deployed by zappa.
Any kind of help and sharing experiences would be really appreciated!
There is an open pull request that is ready to merge, but needs additional user testing.
The older project has a pull request that claims layer support has been merged
Feel free to try it out and let the maintainers know so documentation can be updated.

Installing Python 2.7.16 and packages offline. Concerns with dependencies

Problem
I am attempting to install Python 2.7.16, openpyxl, and pyinstaller onto a Windows 10 machine that is offline for security reasons. To clarify, I have a mapped network drive on there from which I can transfer the files I need to use.
Question
What is the best way to go about this? I currently have a .msi Python installation file directly from their website. The packages I need are packaged as .tar.gz files. I currently have those on my windows machine, but do not want to proceed until I know for sure what I need to do. Also, do I need to do anything for dependencies? If so, how do I find the dependencies for the packages I need?
Side Notes
The version of Python (2.7.16) comes with pip. Not sure if that makes a difference. Downloading and transferring things requires me to ask my admin, for him to download the files, and then transfer them to my drive so I can have them on my computer. If able, I would like to do this in as little attempts as possible.
Useful links
Python: https://www.python.org/downloads/release/python-2716/
openpyxl: https://pypi.org/project/openpyxl/#files
pyinstaller: https://pypi.org/project/PyInstaller/#files
My solution would be to seek out the offline versions of the python and pip installer and follow this guide
Also a great tip: try the complete procedure (the installing of the required software) on a seperate pc which you have disconnected and do the installation. Note everything you have to do to get it working and use those instruction on your originally intended machine. This will prevent you from having to go back and forth and scratch your head while installing on the target machine.
Please note that I have NO idea how python works and this is just a hunch from me as a programmer.
Installing Python and packages on an Offline Machine: A Comprehensive Guide
The Environment
Let us begin by defining the environment in which this guide may be of some great use. If your situation can be described by one or more of the following, you might have great results following this guide...
The machine you are developing on is offline. (No connection to the internet)
You need to develop and run Python on the machine that is completely offline.
If this sounds like you, read the following cases in which a few minor details may make a big difference in getting you started.
Case1:
You are not allowed to plug in any external media devices into the offline machine. This includes but is not limited to a USB, CD, floppy disk, or any other removable media that may be of some use in helping you transfer Python files to the offline machine.
You are allowed to map a network drive (somewhere else on the local network). This would fix the problem mentioned in number one with removable media.
Answer: In this case, just proceed with the guide, as this was my case and I will explain in detail how I solved my problem.
Case2:
There is no physical way to transfer files onto the development machine that is offline.
Answer: If this is your case, you need to get in touch with the admin team who handles the software on your development machine. Direct them to this guide to proceed.
Let's Get Started
Warning A:
The following must be performed on a computer with an internet connection. It is impossible to download things from any website without an internet connection.
Warning B:
There is a longer way, and there is a shorter way to do the following. To avoid the longer way, you must be able to install python on a different machine that is online. This can be the same machine that you are using to download the packages and python version, or it can even be a home machine. This can be any machine in the world that is on the internet. It's sole purpose will be to help you identify the dependencies of each package.
Installing Python
Visit the python website and identify the version you want. 2.7.9 and up is recommended for this guide. Download the file for your specific system.
Python 2.7.9 : https://www.python.org/downloads/release/python-279/
Python 3.7.3 : https://www.python.org/downloads/release/python-373/
The reason I provided Python 2.7.9 is because that is the earliest 2.7.x version that comes with pip (a package manager).
Visit the python package index to locate the packages you will be using in your python project. https://pypi.org/
Search the package you need, go to the downloads, and get the (.tar.gz) file. Not the .whl files unless you know what you are doing with those.
Tip: If you want to keep track of the packages you are installing, I suggest you put them all in one folder somewhere you can find, or just write them down on paper.
Unpack the .tar.gz package files. You can get rid of the .tar.gz once you unpack them as they will not needed any longer.
Install the version of python that you downloaded for your system in step 1 above.
(This may just be running the .msi file for windows or unpacking some files for linux) If you are not sure how, just look at this brilliant guide
https://realpython.com/installing-python/
Now you should be able to go to your terminal and type "python" and get the python interpreter to open up. If you get a "cannot find python command" you need to setup your path variable.
Windows guide: https://geek-university.com/python/add-python-to-the-windows-path/
Linux guide: https://www.tutorialspoint.com/python/python_environment.htm
Your python installation is done! And your packages should also be ready to install!
Installing Python Packages
What you need to know here is that MOST all python packages have dependencies, which are other packages which packages need installed before they can be installed. If you need more explanation on dependencies, read here: https://www.fullstackpython.com/application-dependencies.html
Before proceeding be sure to add the Python/Scripts folder to your path variable too or pip will not work. Follow this link for instructions. https://appuals.com/fix-pip-is-not-recognized-as-an-internal-or-external-command/
Install packages using pip install [package_name] for every package you need, on your machine that is on the internet, and then do a pip freeze to see all the packages installed.
Once you can see all the packages installed, which will include the dependencies for the ones you ran pip install on, you need to manually download these dependencies from the python package index https://pypi.org/ just like you did with the regular packages.
Moving Offline
Once you have identified all the packages you will need, and all of their dependencies, you will need to download them, unpack all of them, and move them into one folder, which I will call "OFFLINE_SETUP_FOLDER".
To be clear:
The packages we installed before was only to find out the dependencies we were going to need. You do not have to re-download the packages you have already downloaded before running pip install. You should only need to download the dependencies you have found during the pip freeze command.
Finally you need to copy into the "OFFLINE_SETUP_FOLDER" your python installation file, be it a .msi file for windows, or the .tar file for linux.
Your "OFFLINE_SETUP_FOLDER" should contain the following...
In the following, package can be the name of any package that you downloaded, and the a and b inpackage1a and package1b just represent dependencies for that package. These file names are just examples for packages
python.msi (installation file for python)
/package1 (normal package folder)
/package1a (package dependency folder)
/package1b (package dependency folder)
/package2 (normal package folder)
/package3 (normal package folder)
/package3a (package dependency folder)
Once this is complete, you need to move that folder onto the machine that is completely offline form the network.
Then run the installation for python as you did before and install it on the machine. Do no forget to setup the path variable. Refer back to the Installing Python section if needed.
Open your terminal or CMD and CD into the "OFFLINE_SETUP_FOLDER".
Now you need to CD into each individual package folder, and run this command: python setup.py install and let it run.
If the package install fails, it will be because one of the dependencies has not been installed. If this is the case, CD into the dependency that is says is missing, and run python setup.py install in there first.
Keep repeating these steps until all packages and dependencies have been installed.
This is the end of this python guide for installing python on an offline machine. I hope this helped :)

Blender on IBM Cloud (Cloud Foundry)

I'm currently developing a web application (Django 2.0) application.
My app will be deployed on IBM Cloud (Cloud Foundry) using python build-pack.
One of my requirements is to install blender.
Everything else is very well, but for blender installation.
What I've tried so far was:
I tried access my app using SSH connection, but surely I don't have root access to apt-get install blender!!
And tried to include blender in packages.json file and push that file using cf push my-app.
But nothing worked for me.
In another shorter question: what is the main approach in Cloud Foundry Apps to install packages like when we use apt-get install in Ubuntu / Debian.
Please correct me if I did anything wrong, or guide me with headlines to solve this problem!!
I see a couple options for you to install packages if they cannot be installed using the regular requirements file (which is the preferred way):
Download the relevant libraries and put them in subfolders of the app before pushing it. The libraries will be uploaded. That is how I would do it.
Once you have an SSH connection, use secure copy (scp) to upload the files and place them in the subfolders where they are expected.
Regarding Blender, the question is what you need in addition to having the code copied over. Does it need a running daemon? Are there more dependencies? You would need to share more information about your specific app to answer that. Maybe, packaging everything as one or more containers and run it on Kubernetes or a combination of Cloud Foundry and Kubernetes is a better way.

Step by Step install of wso2 EMM for Ubuntu

I've visited the wso2 website and the install instructions are very disjointed in that there is a lot of jumping around between pages. I've seen the following blog that seemed to streamline the instructions but it doesn't seem complete (plus it's out of date with the version it's installing) - https://maxmalm.se/blog/2014-06-17-installing-wso2-enterprise-mobility-manager-110
Has anyone seen step-by-step instructions on what needs to be done to completely setup wso2-EMM on a newly installed Ubuntu 14.04 virtual machine with just the O/S on it and none of the pre-reqs installed yet? The blog I mentioned above seems to give a lot of the necessary apt-get install bits but doesn't mention anything about a database (yet the wso2 has a whole section on installing and using a database).
Thank you.
To try out WSO2 EMM you will only need to have JDK 7 or 8 [1] installed as minimum to start off the server. WSO2 products are build to run with OOB database which is H2. So to get things started and play around, I suggest that you install java and then start the pack to get things going.
[1] https://docs.wso2.com/display/EMM201/Installing+on+Linux+or+OS+X
To getting started all you need is JDK installed in your machine and setting the Java related environment variables like PATH, JAVA_HOME. You might have to install the correct version of JDK for the particular version of the EMM.

Django on Mac OS X requires install of MySQLdb

I tried setting up Django to use a MySQL database and it choked because the backend was not available. Reading around the net I see that MySQLdb needs to be installed, and perhaps _mysql needs to be installed as well. I have been surprised that so many different sets of instructions are available, which all seem to do different things in the install process. There are also a large number of posts about the problems with installing MySQLdb, and frequent comments about the install being a PIA. This gives me pause, as I imagine that arbitrary choices which I may make may cause random and hard to track down bugs.
Is there a consensus on what the most reliable install method is?
I don't mind configuration issues. I'm just hoping not to create original problems. As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
I use Homebrew to install stuff like MySQL. It's pretty simple:
Install Homebrew:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
Install MySQL using Homebrew:
brew install mysql
Install the MySQL Python module using your preferred Python installation mechanism (I prefer using Pip):
pip install MySQL-python
As a general rant, with MySQL being so common of a DBMS, why isn't the backend already installed in Django?
You can use other database backends with Django (SQLite or PostgreSQL, for example), and the MySQL connector itself is a module installed outside of Django (and potentially used by other software -- it many cases it might already be installed).