Using Bintray generic repo with PIP - pip

I am trying to find out if I can use bintray as python packages repo. I see that bintray does not provide PyPi repo type - https://www.jfrog.com/confluence/display/BT/Supported+Package+Formats.
I am wondering how do I use generic bintray repo to get it working with PIP. When I tried creating a package and version in generic repo, to access it we need to know exact file name. I tried setting PIP_INDEX_URL something like this and it does not work.
https://user:API_KEY#bintray.com/myUser/my-pypi-repo/
I do know that I can download the files to local and install using pip, but that will make managing versions very complex.
Only thing I can do it use 'curl' or 'wget' with exact file path to download. Any suggestions will be of great help.

You need to use PiPy Basic Authentication.
The install command you need to use is:
pip install my-pypi-package --index-url=https://dl.bintray.com/myUser/my-pypi-repo/
For private repository, you'll need to add credentials:
pip install my-pypi-package --index-url=https://username:api_key#dl.bintray.com/myUser/my-pypi-repo/
Remember to have all the required files under this path https://dl.bintray.com/myUser/my-pypi-repo/

Related

Can 'go install' be made to work for executables with different names from the git repo?

Go has a nice feature where you can go install <x> and it will download, build and install a binary.
For example, on my local windows PC, go install github.com/goreleaser/goreleaser will find the latest release for goreleaser, download, build and install it to my local binaries path.
I am working on a project where we would like to enable go install, but encounter a problem if the github repo name does not match the executable name. The GitHub CLI itself runs into the exact same problem:
Example:
go install github.com/cli/cli#latest
go: downloading github.com/cli/cli v1.14.0
go: github.com/cli/cli#latest: module github.com/cli/cli#latest found (v1.14.0), but does not contain package github.com/cli/cli
Is there a way to resolve this?
Update: I worked out that I could directly reference the package via it's sub directory. In my particular instance this works: go install github.com/OctopusDeploy/cli/cmd/octopus#latest
This is a bit unpleasant, but works correctly. It doesn't work for the github CLI because their go.mod has a replace directive in it :-(
Question: Can this be made nicer? Is there a way to put some sort of alias or configuration file so that go install github.com/OctopusDeploy/cli#latest can be used instead of go install github.com/OctopusDeploy/cli/cmd/octopus#latest ?
Can this be made nicer? Is there a way to put some sort of alias or configuration file so that go install github.com/OctopusDeploy/cli#latest can be used instead of go install github.com/OctopusDeploy/cli/cmd/octopus#latest ?
No. Dead simple.

go install github.com/dmacvicar/terraform-provider-libvirt#latest - shows error

I am trying to Provision VMs on KVM with Terraform.
one of the steps in installations is to download and install the provider buy the command:
go install github.com/dmacvicar/terraform-provider-libvirt#latest
but it errors:
The go.mod file for the module providing named packages contains one or
more replace directives. It must not contain directives that would cause it to be interpreted differently than if it were the main module.
I didn't find a solution, is someone has faced it?
thank you
As JimB notice in comments:
If there are replace or exclude directives in the module, the correct
installation method is to clone the source and install it,
git clone github.com/dmacvicar/terraform-provider-libvirt
cd terraform-provider-libvirt
go install

In a Google Cloud Function, can you specify an alternative pip repository that doesn't require authentication?

Google clearly documents that there is no way for the Cloud Function build process to use an alternative pip repository that requires authentication. But is there any way to use one that doesn't require authentication? I don't see any way to specify an alternate repository location.
As you mentioned, there is no way yet to build an alternative pip repository that doesn’t require authentication.
Private dependencies are used.
Dependencies are installed in a Cloud Build environment where SSH keys are not available.
As explained in the last section, packages hosted in repositories that require SSH-based authentication must be vendored and uploaded alongside your project's source.
Before deploying your project, use the pip install command with the -t DIRECTORY argument to transfer private dependencies into a local directory:
Place your dependent in a local directory as follows:
pip install -t DIRECTORY DEPENDENCY
To make it into a module, place an empty init.py file in the DIRECTORY directory.
Import from this module to use your dependency:
import DIRECTORY.DEPENDENCY
Specifying dependencies in Python
With the recommendation of the only comment for your question, here is a Setting up authentication to Python Package Repository document, you should verify that the required permissions are configured.

jython 2.7 package installation

Jython Package installation issue, using pip
Hi, I have installed Jython2.7 configured with pydev in eclipse neon, also configured python 3.6 package
I am able to install packages for python using pip installer?
pip install "packagename"
Below are some of the packages in python/Lib/Site-packages directory
I was able to install all the packages
How do I use pip installer to install packages for jython?
I tried to install Jip package with
jython install setup.py
The binary File got installed in the Jython/Lib/Site-packages folder
However, I am not able to use it.
where and how do I get Jython package binaries like jip?
Also, Please let me know how to search jython packages?
Also, How to make pip install library packages in jython?
Any other configuration like jython home, etc that should be made?
This answer is going to be really generic but I just recently have slogged my way through the setup for jython/jip/pip and here's roughly what I had to do.
Firstly, I'm running Windows 7 64 Bit from behind a proxy (work machine.)
Had to install jython 2.7.0 instead of 2.7.1 because (I think anyway) 2.7.1 requires admin privileges which I don't have on my work PC.
Pip didn't install correctly during the Jython installation and I spent an obscene amount of time trying to get it installed and functioning as I knew it from my cpython days. NOTE: Just because you get pip installed, doesn't mean you can use any package on a python package repo. As of 2.7.0, Jython doesn't have end to end capability to interpret/compile some libraries that rely on certain python wrappers of native OS function calls. I believe 2.7.1 makes solid progress in the direction of supporting all needed native calls but don't quote me on that. For example, I tried to use wxPython to make a simple GUI to test my jython install. Trying to install it from pip kept causing really non-specific error info that took me a lot of time to figure out that the cause was jython simply couldn't compile the wxPython source so beware.
I had to set environment variables 'http_proxy' and 'https_proxy' in the form of http://proxyhosturl:port and https://proxyhosturl:port respectively to get out from behind the proxies without having to invoke pip with the proxy switch every time I called it.
To actually install pip, have a look here. These instructions are for Python and Linux/Unix but the principle is roughly the same. Just use jython -m instead of python -m and ignore the '$' at the start of each command line.
Also be sure to CD to your python_home/bin folder when invoking the ez_install exe.
If that doesn't work (didn't for me), try using get-pip.py script with these instructions https://pip.pypa.io/en/stable/installing/ (remember jython instead of python etc.). Download it, cd to the download location and follow the noted install steps. Worth noting is about half way down the install instructions where it details installing from local archives (source/binary zip or tar.gz archives of pip and setuptools as better described here: https://packaging.python.org/tutorials/installing-packages/#installing-from-local-archives).
The links to the bin archives of pip and setuptools are here:
https://pypi.python.org/pypi/setuptools
https://pypi.python.org/pypi/pip
It may also be worth making sure that your PATH environment variable has the jython/bin path in the variable value. The jython installer should do this but, again, mine did not.
If all goes well, you should be able to invoke pip with the --version switch and if it prints a line with the installed pip version info then you should be good to go
Another quirky issue I had was I could invoke a function of pip one time and any subsequent times I would get a stack trace ending with something along the lines of an object not having a certain property. I fixed that by finding my temp directory by opening a windows explorer instance and typing %TEMP% in the address bar and hitting enter, it should take you to a subdir of your AppData folder and there you may see a folder with the name of the package you were trying to install and the text "_pip" somewhere in the directory name. Delete the directory and try the pip install command again. I had to do this + invoke pip install pip -U to update my install to the latest version. Then pip began behaving correctly in my instance.
pip search numpy (or your library name) will generate a list of results with the same logic it uses to locate your desired package when you call pip install but, again, just because it returns a matching package doesn't mean it will compile when you install it (numpy doesn't work because of the missing java to C native function calls I described earlier.) The trade off is that you can import code artifacts from Java JAR files in your Jython script files and leverage their functionality with relative ease. Between the public Java APIs available and the python packages that work with the jython interpretor, you can (in my experience) come up with a way to accomplish your task. See the following info on JIP, Maven and IDEs.
IDE and jython integration (Eclipse)
- If you are stuck using Eclipse (like me) it actually has pretty decent support for python development. Install the PyDev plugin for Eclipse from Help -> Install Software. Put in this URL https://marketplace.eclipse.org/content/pydev-python-ide-eclipse, hit tab, and select the PyDev plugin and hit 'finish.'
- Setup the jython interpretor info from Windows -> Preferences -> PyDev. Provide the path to your jython.jar file.
- You should now be able to use File -> New PyDev project to create a basic python project and configure it to use your version of Jython and Java.
Brief Overview of Jip and Maven
- jip is a jython package that is invoked very similarly to pip but instead will download JAR files from the Maven Central Repository instead of python packages from pypi.com, for example. See the install instructions described here. Note the install procedure for a global jip install which differ from just pip install jip. https://pypi.python.org/pypi/jip/
- I never got jip to work exactly as I wished because there's not a ton of documentation on it outside of what I already linked. However, if you install a JAR using jip, you have to go to your project in Eclipse and actually add the JARs themselves to your PYTHONPATH in order for import statements and editing to have intellisense and so that you don't get a classnotfound exception at runtime. See following screen shot.
- There is a JIP config file that you can use similar to the pip config ini file but I have yet to find any exhaustive documentation on it's setup.
Note in the above screen shot the first entry in the External libraries entries. By default, pip places installed packages in that directory so to enable eclipse to find them, you need to also ensure that location is entered.
In Conclusion
- I have more to add to this answer and I will do so as soon as possible. In the meantime, see this example project I've loaded into github.
https://github.com/jheidlage1222/jython_java_integration_example
It shows basic config and how to interface with JARs from python code. I used the apache httpcomponents library as an example. Good luck amigo.

How to install libquicktime on CentOS 7 in one (or two) line of command?

For some reason, I need support of QuickTime on my CentOS 7. So I searched the internet and found that something called "libquicktime" can provide that support. So I download the rpm file from http://rpmfind.net/linux/rpm2html/search.php?query=libquicktime%28x86-64%29. Then I ran command rpm -i libquicktime-1.2.4-31.el7.x86_64.rpm and got the following errors:
warning: libquicktime-1.2.4-31.el7.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 66534c2b: NOKEY
error: Failed dependencies:
libfaac.so.0()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
libfaad.so.2()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
libmp3lame.so.0()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
libquicktime.so.0()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
libschroedinger-1.0.so.0()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
libx264.so.142()(64bit) is needed by libquicktime-1.2.4-31.el7.x86_64
I can install these missing dependencies by querying for their package name and install them one by one manually. But this is so tedious and time consuming, so I am wondering if there is any one-strike single-line (or two) command that can automatically install all dependencies, as well as the target rpm file. I hear that yum has a similar function but I don't know how to use yum to install libquicktime because it complains "No package libquicktime available."
Thanks for any (working) answer.
PS: I'm using CentOS 7, so please don't point me to those too old CentOS 6 links. I've read them, they are only a waste of time on 7. Thanks.
(aside)
Some versions of rpm (but not you on Centos 7) can add missing dependencies when given a database of "everything" including paths to download the package from.
On Centos 7, yum is the best answer. You would need to configure a local repository in /etc/yum.repos.d/something pointing to a local repository.
The local repository (i.e. a local directory somewhere) should contain the libquicktime package, and you need to run createrepo in that directory to generate the repository metadata that yum uses to build a transaction.

Resources