spack: Error: attribute 'closed' of '_io._IOBase' objects is not writable
Steps to reproduce
The error occurs in
cat > Vagrantfile << \EOF
Vagrant.configure("2") do |config|
config.vm.box = "qnib/rocky8-spack"
config.vm.box_version = "2022.02.08-v2"
end
EOF
vagrant up
This spins up a virtual machine with spack installed.
$ vagrant ssh
[vagrant@localhost ~]$ sudo su - spack
[spack@localhost ~]$
I followed the following steps to create a binary cache.
Note: The S3 bucket is already created using aws s3 mb s3://name.
Binary cache creation
Let’s create a binary cache in AWS S3 and upload some packages to show the benefit.
export GPG_KEY=qnib-binary-cache-key
export BUILD_CACHE=spack-vagrant-cache
export GPG_EMAIL=spack@test.com
Create S3 Bucket
Log into your AWS console and create a bucket with the name specified above.
First, we need to configure the awscli with our AWS credentials.
aws configure
Make sure to use a IAM profile that is restricted to only read and write to the bucket in question.
$ aws configure
AWS Access Key ID [None]: <YOUR_ACCESS_KEY>
AWS Secret Access Key [None]: <YOUR_SECRET_KEY>
Default region name [None]: eu-west-1
Default output format [None]:
GPG Keys
spack gpg init
spack gpg create ${GPG_KEY} ${GPG_EMAIL}
This will create a key within ``.
$ spack gpg create ${GPG_KEY} ${GPG_EMAIL}
gpg: keybox '/opt/spack/opt/spack/gpg/pubring.kbx' created
gpg: /opt/spack/opt/spack/gpg/trustdb.gpg: trustdb created
gpg: key TEST123 marked as ultimately trusted
gpg: directory '/opt/spack/opt/spack/gpg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/opt/spack/opt/spack/gpg/openpgp-revocs.d/TEST123.rev'```
### Create Mirror
```bash
spack mirror add ${BUILD_CACHE} "s3://${BUILD_CACHE}"
spack mirror list
A mirror should be added to your local ~/.spack/mirrors.yaml.
$ spack mirror list
spack-vagrant-cache s3://spack-vagrant-cache (fetch)
spack-vagrant-cache s3://spack-vagrant-cache (push)
spack-public https://mirror.spack.io
$
Install Package
spack install bzip2
Fill Cache
spack buildcache create -f --rebuild-index -k ${GPG_KEY} -m ${BUILD_CACHE} bzip2
Use Cache
The mirror we added above is per user, by changing the user we can utilize the mirror.
export BUILD_CACHE=spack-vagrant-bins
spack mirror add ${BUILD_CACHE} "s3://${BUILD_CACHE}"
spack install --no-check-signature --cache-only bzip2
Error message
OK, that the setup…
I am encountering this error. Sometimes when I am installing software…
[spack@localhost ~]$ spack install bzip2
[+] /nfs/share/spack/pkg/linux-rocky8-x86_64/gcc-8.5.0/libiconv-1.16-35blyeuqkakrjcje6b7rpi52bylxmjoc
[+] /nfs/share/spack/pkg/linux-rocky8-x86_64/gcc-8.5.0/diffutils-3.8-ku4gppnjmbo2e6zdcb6ht2nzjdid2ac7
==> Installing bzip2-1.0.8-pbg6ou5bp6d3ob66fvd4ymetnbkegtgj
==> Error: Failed to install bzip2 due to AttributeError: attribute 'closed' of '_io._IOBase' objects is not writable
==> Error: attribute 'closed' of '_io._IOBase' objects is not writable
[spack@localhost ~]$
Sometimes when I want to upload to the S3 bucket.
$ spack buildcache create -f --rebuild-index -k ${GPG_KEY} -m ${BUILD_CACHE} bzip2
==> Pushing binary packages to s3://spack-vagrant-cache/build_cache
gpg: using "qnib-binary-cache-key" as default secret key for signing
==> Error: attribute 'closed' of '_io._IOBase' objects is not writable
Information on your system
$ spack debug report
* **Spack:** 0.17.1-1106-c1b51d6e99
* **Python:** 3.6.8
* **Platform:** linux-rocky8-sandybridge
* **Concretizer:** clingo
Note: Since my setup should be only used to to dryrun testing I specified x86_64 in the packages.yaml.
$ cat /opt/spack/etc/spack/packages.yaml
packages:
all:
target: [x86_64]
slurm:
buildable: false
externals:
- spec: slurm@21-08-5-1
prefix: /usr
openmpi:
variants: +pmi +legacylaunchers schedulers=slurm
version:
- 4.1.0
$ cat /opt/spack/etc/spack/config.yaml |grep -v "#"
config:
install_tree:
root: /nfs/share/spack/pkg
source_cache: /nfs/share/spack/cache
misc_cache: ${HOME}/cache
$ cat /opt/spack/etc/spack/compilers.yaml
compilers:
- compiler:
spec: gcc@8.5.0
paths:
cc: /bin/gcc
cxx: /bin/g++
f77: /bin/gfortran
fc: /bin/gfortran
flags: {}
operating_system: rocky8
target: x86_64
modules: []
environment: {}
extra_rpaths: []
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 25 (19 by maintainers)
Commits related to this issue
- Fixed botocore issue identified in https://github.com/spack/spack/issues/28830 — committed to bollig/gitlab-runners by bollig 5 years ago
Can we please update the code to work with new botocore instead of freezing it?
In my case, I’m setting
url_fetch_method:curl(for a reason I can’t remember). This issue may be related to: https://github.com/spack/spack/issues/28753 ?