My app has a requirements file that looks something like this:
somelibrary==2
otherlib==1.5
Now the problem is that otherlib contains in its setup file somelibrary as dependency and what happens is that pip first installs somelibrary in version 2 as required by my file, but later installs an older version because of otherlib which hides the version of somelibrary that my app needs and that also works for otherlib. I checked the setup.py file of otherlib and it does not specify a version for somelibrary. How can I stop pip from installing the older version on top of the newer one?
Related
I realize that a requirements.txt file can be used to pin the versions used in pip install. Sometimes I don't want to go through all that- and just simply want to protect my installation from downgrades. Is there any way to instruct pip install to do that?
An example: I just installed librosa and it downgraded numpy from 1.24.1 to 1.23.5 . I don't want that behavior to happen unless I explicitly request. On the other hand if there are missing dependencies then please let's grab them.
For this installation of python it is acceptable to take the risk of occasionally ending up with a mismatch due to installing newer versions [ but I don't want older ones].
In my pyproject.toml I have some dev dependencies configured as follows:
[tool.poetry.group.dev.dependencies]
mypy = "^0.971"
A simple poetry show -l shows that I indeed have mypy installed with version 0.971. Currently, the latest version available is v0.991.
What's the correct syntax to have all my dependencies - including dev dependencies - being updated.
poetry update --with=dev is not going to update mypy to the latest version.
poetry update updates dependencies within the version range given in the pyproject.toml.
^0.971 translates to >=0.971,<0.972 (See: https://python-poetry.org/docs/dependency-specification/#caret-requirements). This is why poetry update will not update mypy to 0.991.
To get the latest version of a dependency you have to use poetry add <dep>#latest. In your case poetry add -G dev mypy#latest.
At the moment there is no Poetry command to bump all dependencies to its latest version outside of the given version ranges. But there is a feature request for it: https://github.com/python-poetry/poetry/issues/461
I have used a YAML file and have imported PyYAML into my project.
The code works fine in PyCharm, however on creation of an egg and running the egg gives an error as module not found on command prompt.
You have not provided quite enough information for an exact answer, but, for missing python modules, simply run
py -m pip install PyYaml
or, in some cases
python pip install PyYaml
You may have imported it in your project (on PyCharm) but you have to make sure it is installed and imported outside of the IDE, and on your system, where the python interpreter runs it
I have not made an .egg for some time (you really should be consider using wheels for distributing packages), but IIRC an .egg should have a requires.txt file with an entry that specifies dependency on pyyaml.
You normally get that when setup() in your setup.py has an argument install_requires:
setup(
...
install_requires=['pyyaml<4']
...
)
(PyYAML 4.1 was retracted because there were problems with that version, but it might be in your local cache of PyPI as it was in my case, hence the <4, which restricts installation to the latest 3.x release)
I'm trying to build the necessary dependencies to run some deep learning code and am running into issues with the c foreign function interface (cffi) installation. I need conda's accelerate package, however the package is built on top of an old version of cffi (1.10). I need it to be built on top of cffi version 1.11.2 which I can obtain through pip. Is there some way to exclude certain sub-dependencies when installing through conda? I'd assume this would mess up my accelerate install even if I were able to somehow replace the cffi dependency, but figured I'd see what my options are regardless
I want to install the package dataframe of Octave on one of my servers, which does not have internet access. I used my laptop to download dataframe-1.1.0.tar.gz. I wonder how I can install it on my server manually.
In the README.html of Octave 4.0.0 folder you can find the following passage:
Included Octave Forge Packages
A number of Octave-Forge packages have been included with Octave, however they must be installed in order to use them.
To install:
• Start Octave and then open the build_packages.m file found in the src folder where Octave was installed.
• Run the script build_packages.m to build and install the packages.
Installation is a one-time procedure. After installation packages must still be loaded in order to use them with the pkg load PACKAGENAME command.
Other packages are available from Octave-Forge.
What you need to do for other packages, which are not included with Octave, is: download the package from http://octave.sourceforge.net/packages.php. Then put the package in the src folder and modify build_packages.m respectively before executing it.
According to the Octave documentation:
37.1 Installing and Removing Packages
Assuming a package is available in the file image-1.0.0.tar.gz it can
be installed from the Octave prompt with the command
pkg install image-1.0.0.tar.gz
If the package is installed successfully nothing will be printed on
the prompt, but if an error occurred during installation it will be
reported. It is possible to install several packages at once by
writing several package files after the pkg install command. If a
different version of the package is already installed it will be
removed prior to installing the new package. This makes it easy to
upgrade and downgrade the version of a package, but makes it
impossible to have several versions of the same package installed at
once.