How do I upgrade a pipenv package and ignore prerelease packages? - pipenv

This fails ("Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.")
#!/usr/bin/env bash
pipenv install requests
pipenv install black --dev
pipenv update requests
The update fails because black only has pre-release versions.
# fails with warning
pipenv update requests --pre
# no such option for *update*
pipenv update requests --skip-lock
This implies that I'd have to uninstall black, then update the relevant package, then re-install black, for every attempt to update.
So far, all I've found is maybe telling pip to let all updates take the most recent pre-release packages, in this case for black and requests. This doesn't seem like a good idea when only black is a permanent pre-release package.
Also, note that pipenv in this case holding up everything because of --dev dependencies that won't matter in the final build.

Try installing a specific version of black.
#!/usr/bin/env bash
pipenv install requests
pipenv install black==18.9b0 # the latest as of 2018-12-09
pipenv update requests
pipenv update requests --pre
# afik, the --pre flag here doesn't do anything
cat Pipfile | grep allow_preleases
# avoids allowing prereleases for all packages

Related

Yarn Unknown Syntax Error: Unsupported option name ("--check-files")

When I try to run yarn install --check-files on a rails repo that I cloned I'm getting the following error:
Unknown Syntax Error: Unsupported option name ("--check-files").
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
I've tried updating yarn and node to the latest stable versions
I've tried deleting yarn/node modules and yarn.lock in the local folder and running yarn install again
I've tried yarn upgrade --latest which also brings up a similar error Usage Error: Couldn't find a script named "upgrade".
I'm currently using volta to manage my versions and have not had too much trouble up until now.
I've previously run --check-files on other repos with no problems.
Ok turns out my system was running yarn 3.* globally which was conflicting with my rails version (6.0.5). I had originally installed yarn using brew so I had to uninstall and start again with npm using the following steps:
brew uninstall yarn to remove yarn with brew
npm install -g yarn to install yarn with npm
yarn set version classic to set yarn version to 1.*
yarn -v to make sure I was on version 1.*

pipenv not installing any package?

When I do the pip freeze I can see all the packages but when I do the pipenv install it is not installing any packages.
This is what I am getting when I do pipenv install.
Installing dependencies from Pipfile.lock (0a15b8)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
I expect you are using pipenv virtual env as well for your project. I uninstalled all the packages from the env using: pipenv uninstall --all and then did pipenv install to install all the packages from pipfile and it worked.
Posting the solution for this, if someone is facing the same.
Just update your Pipfile.lock file by running the pipenv update Pipfile.lock, and then do the pipenv install.

Yarn packages won't update for dependency issue

On a development server, for an application barely deployed, rails commands won't execute because of lack of integrity file.
error Couldn't find an integrity file
error Found 1 errors.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
Both
yarn install --check-files
yarn install
lead to the same error
compression-webpack-plugin#4.0.1: The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "8.17.0"
Found incompatible module
Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The 'visit' prompt is unfortunately of no use, as it does not deal with the node engine.
Being barely deployed, there is no node-modules directory yet, which is expected. However on development machine there is the directory and no issues whatseoever in precompiling assets.
Server context:
node -v
> v8.17.0
How can this situation be unblocked?
you need to update the node to a version higher than the one mentioned >= 10.13.0 then re-install yarn and re-run the check:
if you're on Mac OS:
brew install node#14 && brew link --force node#14
brew install yarn
if you're on Linux:
cd ~
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
then check if you have a compatible version
node -v
=> v14.2.0
``
if so re-run any of your commands:
```bash
yarn install --check-files
yarn install

brew install yarn version

I tried using
brew install yarn#1.7.0 --without-node
or
brew install yarn#1.7.x --without-node
But I get the following error
Error: No available formula with the name "yarn#1.7.0"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
I presume its possible to install different versions of yarn using brew ?
I had the same issue and wanted to install yarn via brew for various reasons. Honestly the only way is to use the actual link to the yarn.rb file in the Homebrew Repo for the version you want. The easiest way to find the .rb file through git is to check out the PRs in Git for yarn in the homebrew repo.
Before doing this though, run brew unlink yarn in order to allow an older version to be installed while keeping the newest version.
Then look up the PR of the version you want, here's a link to make your life easier.
Click the version you want and go to Files Changed tab. Click on View File button. Then click on Raw button and then copy the URL of this raw file
After you get that link, type in your terminal brew install [link] and you should be set
You can then use brew list --versions yarn to check your installed versions and brew switch to switch versions. You should have both the latest version you previously had installed and the version you just installed.
Some of the above answers don't seem to work anymore. Here is how I was able to install a specific version in April 2021:
brew unlink yarn#1.6.0 (If you already have a version installed)
brew extract --version 1.22.4 yarn homebrew/cask
brew install yarn#1.22.4
yarn -v
You can also use yvm, a yarn version manager instead of homebrew to install a specific or multiple versions of yarn
https://yvm.js.org/docs/overview
Enables easy switching between yarn versions, like nvm does for node
Hope this works for you guys.
To reinstall run below.
// Note:(updating homebrew) for Mac users.
brew install -g yarn
if yarn is still not found
brew reinstall yarn
As per official github page https://github.com/yarnpkg/yarn/issues/599 you should use "brew install -g yarn" to install yarn using brew.
PS: I've installed Xcode and gcc before running above command as i ran into few issues when executed above command.
You could also use yarn policies set-version <version>, but it has a caveat; it will "check in your Yarn release within your repository. Once you run it, your configuration will be updated in such a way that anyone running a Yarn command inside the project will always use the version you set - and this transparently."
You might not want to have the Yarn release in your repository.
Official doc

"Could not find a version that satisfies the requirement opencv-python"

I am struggling with Jetson TX2 board (aarch64).
I need to install python wrapper for OpenCV.
I can do:
$ sudo apt-get install python-opencv
But I cannot do:
$ sudo pip install opencv-python
Is this because there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?
Is there a way to install opencv-python through pip?
We were getting the same error.For us, it solved by upgrading pip version (also discussed in FAQ of OpenCV GitHub). Earlier we had pip-7.1.0, post upgrading it to "pip-9.0.2", it successfully installed.
pip install --upgrade pip
pip install opencv-python
pip doesn't use http://www.lfd.uci.edu/~gohlke/pythonlibs/, it downloads packages from PyPI.
The problem is that you have an unusual architecture; pip cannot find a package for it and there is no source code package.
Unfortunately I think you're on your own. You have to download source code from https://github.com/skvark/opencv-python, install compiler and necessary libraries and compile OpenCV yourself.
Use this and it will work:
pip install --upgrade pip
pip install opencv-python
Another problem can be that the python version you are using is not yet supported by opencv-python.
E.g. as of right now there is no opencv-python for python 3.8. You would need to downgrade your python to 3.7.5 for now.
It happened with me on Windows, pip was not able to install opencv-python==3.4.0.12.
Later found out that it was due to the Python version, Python 3.7 has some issue with not getting linked to https://github.com/skvark/opencv-python.
Downgraded to Python 3.6 and it worked with:
pip3 install opencv-python
I faced the same issue but the mistake which I was making was pip install python-opencv where I should have used pip install opencv-python. Hope this helps to anyone. It took me few hours to find.
As there is no proper wheel file in http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv?
Try this:(Worked in Anaconda Prompt or Pycharm)
pip install opencv-contrib-python
pip install opencv-python
A way to do this is to install Anaconda on your computer.
Then you should be able to do:
pip install opencv-python
or
conda install opencv
I had the same error. The first time I used the 32-bit version of python but my computer is 64-bit. I then reinstalled the 64-bit version and succeeded.
Install it by using this command:
pip install opencv-contrib-python
I faced same issue while using Python 3.9.0.
Upgrading python to latest version (currently 3.9.1) and reinstalling opencv-python solved this issue.
I got this error and I solved it by simply waiting.
I had similar problem:
ERROR: Could not find a version that satisfies the requirement opencv-contrib-python (from versions: none)
Command pip update was not resolving my issue.
After lunch-time I tried again and it installed correctly the package.
Maybe the server was down.
I update the version of python, and then the issue was addressed. Please refer to this video: https://www.youtube.com/watch?v=BQnpRbbEZB4

Resources