Cabal cannot resolve dependencies - chooses wrong version of `containers`? - cabal

% cabal sandbox init
Writing a default package environment file to
/Users/pmw/yesod-website/cabal.sandbox.config
Creating a new sandbox at /Users/pmw/yesod-website/.cabal-sandbox
0c4de9cd2926% cabal install --upgrade-dependencies --constraint="template-haskell installed" --dependencies-only --enable-tests
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: yesod-website-0.1.0.0 (user goal)
trying: text-1.2.1.1 (dependency of yesod-website-0.1.0.0)
trying: binary-0.7.5.0 (dependency of text-1.2.1.1)
trying: containers-0.5.6.3 (dependency of binary-0.7.5.0)
trying: yesod-form-1.4.4.1 (dependency of yesod-website-0.1.0.0)
next goal: template-haskell (dependency of yesod-form-1.4.4.1)
rejecting: template-haskell-2.10.0.0 (global constraint requires installed
instance)
rejecting: template-haskell-2.9.0.0/installed-c0b... (conflict:
containers==0.5.6.3, template-haskell => containers==0.5.5.1/installed-d4b...)
rejecting: template-haskell-2.9.0.0, 2.8.0.0, 2.7.0.0, 2.6.0.0, 2.5.0.0,
2.4.0.1, 2.4.0.0, 2.3.0.1, 2.3.0.0, 2.2.0.0 (global constraint requires
installed instance)
Backjump limit reached (change with --max-backjumps).
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
My cabal file:
build-type: Simple
cabal-version: >=1.10
executable yesod-website
main-is: helloworld.hs
build-depends: yesod
, yesod-form
, text
default-language: Haskell2010
When I run a plain cabal install instead, it succeeds. But that's not an option for me: I am running this particular invocation of cabal install because I am trying to integrate with CircleCI, and that's the exact command they run. On their system (Linux), it fails precisely the same way as on mine (OS X).
What is happening?

Related

fail (backjumping, conflict set: cardano-crypto-class)

I am trying to install cardano-node to my MacOS by this article.
After cabal build all command I got:
➜ cardano-node git:(4c5944295) cabal build all
Warning: Requested index-state 2021-04-30T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2021-04-29T23:07:55Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: cardano-crypto-class (user goal)
[__0] rejecting: cardano-crypto-class-2.0.0 (conflict: pkg-config package
libsodium-any, not found in the pkg-config database)
[__0] fail (backjumping, conflict set: cardano-crypto-class)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-crypto-class
This is the important part:
conflict: pkg-config package libsodium-any, not found in the pkg-config database
You need to install libsodium.
I think the cabal configure --with-compiler=ghc-8.10.4 step should have failed with the same error. Maybe you missed it: https://developers.cardano.org/docs/get-started/installing-cardano-node/#configuring-the-build-options. And maybe you also need to retry the "downloading & compiling" steps: https://developers.cardano.org/docs/get-started/installing-cardano-node/#downloading--compiling.

I screwed up my Steam installation, how do I fix my broken packages?

I have Ubuntu 18.04, not installed directly but upgraded from 16.10, I haven't used Steam in a while on this computer (maybe since before the 18.04 upgrade, don't remember) which led to problems, and after a while of trawling the Internet for possible solutions, I had to admit defeat.
I tried the sudo apt-get autoremove/update/upgrade/dist-upgrade series, and it didn't do anything.
EDIT: I have also done sudo apt-get clean, and sudo apt-get install -f.
I also tried a full uninstall via deleting .steam/ and .local/share/Steam/ .
I am aware of the method of simply manually installing the packages, but that isn't working for me, either. Observe:
$ sudo apt install steam
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
steam:i386 : Depends: libgl1-mesa-dri:i386 (>= 17.3) but it is not going to be installed or
libtxc-dxtn0:i386
Depends: libgl1-mesa-dri:i386 but it is not going to be installed
Depends: libgl1-mesa-glx:i386 but it is not going to be installed
Recommends: nvidia-driver-libs-i386:i386 but it is not installable
E: Unable to correct problems, you have held broken packages.
From this, I tried to run the following commands:
$ sudo apt install libgl1-mesa-dri:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libgl1-mesa-dri:i386 : Depends: libllvm8:i386 (>= 1:8~svn298832-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libllvm8:i386 : Depends: libatomic1:i386 (>= 4.8) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386 libatomic1:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
debhelper : Depends: dh-autoreconf (>= 17~) but it is not going to be installed
libatomic1:i386 : Depends: gcc-8-base:i386 (= 8.3.0-6ubuntu1~18.04.1) but 8.3.0-16ubuntu3~16.04 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
At this point, I don't really know what to do. Especially in response to the line "but 8.3.0-16ubuntu3~16.04 is to be installed". I have Ubuntu 18.04. Why is something from 16.04 going to be installed?
One more try for completion's sake:
$ sudo apt install libgl1-mesa-dri:i386 libllvm8:i386 libatomic1:i386 dh-autoreconf gcc-8-base:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-8-base:i386 is already the newest version (8.3.0-16ubuntu3~16.04).
gcc-8-base:i386 set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
dh-autoreconf : Depends: libtool (>= 2.4.2) but it is not going to be installed
libatomic1:i386 : Depends: gcc-8-base:i386 (= 8.3.0-6ubuntu1~18.04.1) but 8.3.0-16ubuntu3~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.
And including gcc-8-base:i386 does nothing.
How did I break my install of Ubuntu?
Tried all top Google solutions. None of them worked for me.
Came across this answer that described how we can reset broken packages.
Take a backup of the file /var/lib/dpkg/status first. Then erase all the contents of that file.
Then run sudo apt install steam. It may prompt you if there are files that already exist and will be overwritten. Best that you check for the differences in the file's contents. In my case, I decided to use the one from the package maintainers itself instead of my own.
Steam installed smoothly. Did not get any unmet dependencies error.
When I tried to start steam, I got an error about glxchoosevisual failed. For this, I then had to install libnvidia-gl-450:i386 library. Note that in my case, my nvidia driver version was 450 so used that. You need to use your version here. That's it! Steam then launched fine.
Sharing it here in case it helps somebody.
Check if you have enabled restricted and universe repositories.
You can also run:
This cleans the local repo from packages so they are going to be downloaded again
apt-get clean
This is reinstalling broken packages
apt-get -f install

Installing mongodb-enterprise-server error

Hello guys. Can someone help me about this one? I cant install mongodb because of dependency problem. I already tried updating my linux mint terminal.
dpkg: dependency problems prevent configuration of mongodb-enterprise-server:
mongodb-enterprise-server depends on libcurl3 (>= 7.16.2); however:
Package libcurl3 is not installed.
mongodb-enterprise-server depends on snmp; however:
Package snmp is not installed.
Installing via dpkg -i mongodb.deb will not include additional package dependencies. You should be able to fix your installation by following up with sudo apt --fix-broken install.
Unless you have strong reasons to avoid the standard process I would recommend following the tutorial to Install MongoDB Enterprise by adding the appropriate repo definitions. Adding the normal package repo will also make it easier for you to update to newer minor releases of MongoDB 4.0.x.

Install Racket package only if not installed

I can install a Racket package with:
raco pkg install <pkg-name>
If the package is not installed, it installs it. If the package is already installed however, it will complain that the package is already installed. While this is fine, is there a better way to check if a package is installed, and only try to install it if its not already installed?
For context, I want this because I have a (non-package) Racket project that relies on certain packages being installed. I could put them in an info.rkt file, but as far as I can tell, these won't get installed unless I try to install the project as a package, which doesn't make sense for this domain.
So, is there anyway to determine if a Racket package is installed? Additionally, can I use this information to only install a package if its not already installed?
Yes, in fact you can. If you are using a shell program or makefile (basically, using the raco pkg tool from the command line), you can pass it the --skip-installed parameter. This will only try to install the package if its not already installed. So you could do something like this in a mace file:
all: # Replace spaces here with tabs, because make...
raco pkg install --skip-installed <important-pkg>
<rest-of-makefile>
Alternatively, if you are looking for an 'in Racket' solution, you can use the installed-pkg-table function to get a hash table containing all of the installed packages. From there, its easy enough to do a hash-has-key? to see if the package is in the table. From there, you can use pkg-install-command to install the package. Your total code will look something like this:
(unless (hash-has-key? (installed-pkg-table) "<important-pkg>")
(pkg-install-command #:deps 'search-auto i))
I should note that there is a slight chance that the package database will change between searching for the key and installing the package. If that is important to you, check out with-pkg-lock

Cabal: What does "only already installed instances can be used" mean?

I'm new to Cabal, and this phrase "only already installed instances can be used" doesn't make any sense to me.
$ cabal install base==4.7.0.0
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: base (user goal)
rejecting: base-4.7.0.1 (global constraint requires ==4.7.0.0)
rejecting: base-4.7.0.0 (only already installed instances can be used)
rejecting: base-4.6.0.1/installed-8aa..., 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0,
4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0,
4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires ==4.7.0.0)
Dependency tree exhaustively searched.
What is Cabal trying to communicate here?
Cabal won't let you install base. I ran into this issue when trying to install the profiling version of base. Instead, you need to do something like:
sudo apt-get install haskell-platform-prof
See this thread for a discussion by cabal developers.

Resources