I am using the cloudscraper python library, installed from the Pycharm UI.
Therefore, I am using the main version of this package.
I would like to try to use the dev version of this package, that can be downloaded through github from the relative branch (https://github.com/VeNoMouS/cloudscraper/tree/dev). In order to install this dev package, I have to run python setup.py install.
Is there a way to keep both versions of this module? How can I install the dev package directly from the UI?
Python does not handle having multiple versions of the same library installed. See for example this related question.
Indeed, the solution is to modify the files for one of the version to give it a different name (for example cloudscraper-dev).
Or you could have two different virtual env, one for each version, but it requires to switch from one to the other.
Related
Well, I think that the "Pinax" package is no longer maintained ...
Anyway, it refers to a now-deprecated django.utils.tzinfo package. I need to make a one-line change to one source module, and then cause that version of the package to be loaded instead of the one in the module directory. Is there a generic way in Django to do that sort of thing? (I know that some packages such as the Machina forum software can do this.)
I would uninstall the module you want to modify from your virtual environment, then fork the module to your github, commit your changes, and install it to your virtual environment from your github like
python -m pip install git+https://github.com/path/to/repo
I have a Pycharm project where I have copied two github projects (download zip and copy paste into project). My problem is that I cannot access the from main, which is located at root.
For some unknown reason from . syntax only shows me files/folders I have created myself.
I'm trying to access build module where there is a class TFNET which I want to import
from darkflow-master.darkflow.net.build import TFNET
Downloading directories like this isn't how you'd typically include external dependencies in a python project.
A more conventional approaches would be ot install the project using pip, it looks like darkflow gives information on how to do this.
Alternatively, just ensure the libraries are in your PYTHONPATH, it looks like pycharm has a way to do this: PyCharm and PYTHONPATH
Reading between the lines, it sounds like you have downloaded two libraries from github, and copied them into your project.
Python needs to know where to find source files.
If you want do it this way, you need to tell your python environment where to find the new sources. Pycharm looks after python environments while you are in python.
Please see https://www.jetbrains.com/help/pycharm/configuring-folders-within-a-content-root.html
but this won't tell python outside of Pycharm where to find your library source.
pip is most likely the answer. pip can install globally or inside python virtual environments, in either case, it puts the library code in a location python is expecting to find it.
On this point, please learn about python virtual environments. These are self-contained python mini-worlds. In a venv, you can run a specific version of python with specific packages. Pycharm works well with them, it is easy to set up virtual envs with pycharm. When you are 'inside' a venv, pip will install into the venv, therefore not touching your system python or the python of any other projects.
Also, pip normally installs from an official repository (pypi) but you can tell it to use a git repository as the source of your install. Normally people who write libraries send their mature versions to pypi so it is unusual to fetch from a git repository, but if you want the very latest version, or if the author has not published the library, it's an option.
Note that pip doesn't work with any arbitrary python code. It must be set up to be seen by pip as a python package.
I used to work with windows when I install a non basic python package with the cmd, but I dont know how to do it on mac, this packaged cant use pip to install on the terminal
It really depends a lot on the specific package. The options can be different, let me present you some:
You can simply add the source files (if they are not properly packaged) to your project and import them
In the same scenario, if the script is not packaged, you can check if there is a way to install it (read the docs). A common way to do it is by having a script in root called setup.py. Try to see if there is a setup script or read the docs to see if there is a way to install it
Check if the package can not be installed with another general package management (you mentioned you use a mac so check with homebrew)
Another possible package management tool for Python is Anaconda, check that one too
Hope this helps!
I am trying to develop a python package that is importable and also has entry_point to call from shell.
When trying to call the entry point I get:
pkg_resources.VersionConflict: (pysec-aws 0.1.dev1 (/Users/myuser/PycharmProjects/pysec-aws), Requirement.parse('pysec-aws==0.1.dev0'))
Essentially what I did before getting this error, is incrementing the version from 0.1.dev0 to 0.1.dev1 in setup.py, and running python setup.py sdist and then pip install -e .
What am I doing wrong? What is the proper way to install development versions of packages you are actively developing and bundling with setuptools?
The error is complaining that the application version does not match the version declared in setup.py. Try checking the __version__ set in your application.
You might consider using a single source for the version to avoid this problem. There are a number of different options outlined at https://packaging.python.org/guides/single-sourcing-package-version/. One simple technique, if there are not any external dependencies, is
import myapp
setup(
...
version=myapp.__version__
...
)
The only thing that fixed this issue was to create a new virtualenv.
Apparently my virtualenv/bin had compiled (.pyc) and non-compiled (.py) references to the old version for some reason - they were probably not upgraded / removed when I installed the new version.
Once I created a new virtualenv and re-installed required packages I was able to resolve this issue.
We have set up a local python package server for your internal python packages and serve also some packages which are hard to compile on windows. As numpy is one of these packages, there exist now two versions of numpy on our server:
numpy-1.13.0-cp35-none-win32.whl
numpy-1.13.0+mkl-cp35-cp35m-win32.whl
How can I instruct pip to install a specific version of these two? Running pip install numpy will pick the package with "mkl", but for some projects I want numpy without "mkl".
Edit:
The only way which works is the full URL to the package, which seems a little bit verbose.
From what I can remember, it's just a matter of writing the package's entire name.
If you need a guide:
https://pip.pypa.io/en/stable/reference/pip_install/#examples