attr error while installing with pip, pip installation shouldn’t be 'sudo' prefixed
error while installing with pip3
silkaj
Traceback (most recent call last):
File "/home/thomas/.local/bin/silkaj", line 20, in <module>
from silkaj.cli_tools import cli
File "/home/thomas/.local/lib/python3.7/site-packages/silkaj/cli_tools.py", line 22, in <module>
from silkaj.tx import send_transaction
File "/home/thomas/.local/lib/python3.7/site-packages/silkaj/tx.py", line 24, in <module>
from silkaj.network_tools import ClientInstance, HeadBlock
File "/home/thomas/.local/lib/python3.7/site-packages/silkaj/network_tools.py", line 25, in <module>
from duniterpy.api.client import Client
File "/home/thomas/.local/lib/python3.7/site-packages/duniterpy/api/client.py", line 9, in <module>
import jsonschema
File "/home/thomas/.local/lib/python3.7/site-packages/jsonschema/__init__.py", line 12, in <module>
from jsonschema.exceptions import (
File "/home/thomas/.local/lib/python3.7/site-packages/jsonschema/exceptions.py", line 141, in <module>
@attr.s(hash=True)
AttributeError: module 'attr' has no attribute 's'
- Show closed items
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- matograine added Install label
added Install label
- Moul added Documentation label
added Documentation label
@matograine, as-tu finalement trouvé une solution ?
$ sudo python3 -m pip install attr Collecting attr Downloading https://files.pythonhosted.org/packages/de/be/ddc7f84d4e087144472a38a373d3e319f51a6faf6e5fc1ae897173675f21/attr-0.3.1.tar.gz Building wheels for collected packages: attr Running setup.py bdist_wheel for attr ... done Stored in directory: /root/.cache/pip/wheels/f0/96/9b/1f8892a707d17095b5a6eab0275da9d39e68e03a26aee2e726 Successfully built attr Installing collected packages: attr Successfully installed attr-0.3.1 $ silkaj Traceback (most recent call last): File "/home/simon/.local/bin/silkaj", line 20, in <module> from silkaj.cli_tools import cli File "/home/simon/.local/lib/python3.7/site-packages/silkaj/cli_tools.py", line 22, in <module> from silkaj.tx import send_transaction File "/home/simon/.local/lib/python3.7/site-packages/silkaj/tx.py", line 24, in <module> from silkaj.network_tools import ClientInstance, HeadBlock File "/home/simon/.local/lib/python3.7/site-packages/silkaj/network_tools.py", line 25, in <module> from duniterpy.api.client import Client File "/home/simon/.local/lib/python3.7/site-packages/duniterpy/api/client.py", line 9, in <module> import jsonschema ModuleNotFoundError: No module named 'jsonschema' $ sudo python3 -m pip install jsonschema Collecting jsonschema Downloading https://files.pythonhosted.org/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56kB) 100% |████████████████████████████████| 61kB 1.6MB/s Requirement already satisfied: six>=1.11.0 in /usr/lib/python3/dist-packages (from jsonschema) (1.13.0) Collecting importlib-metadata; python_version < "3.8" (from jsonschema) Downloading https://files.pythonhosted.org/packages/e9/71/1a1e0ed0981bb6a67bce55a210f168126b7ebd2065958673797ea66489ca/importlib_metadata-1.3.0-py2.py3-none-any.whl Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from jsonschema) (41.2.0) Requirement already satisfied: pyrsistent>=0.14.0 in /usr/lib/python3/dist-packages (from jsonschema) (0.15.5) Collecting attrs>=17.4.0 (from jsonschema) Downloading https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->jsonschema) Downloading https://files.pythonhosted.org/packages/74/3d/1ee25a26411ba0401b43c6376d2316a71addcc72ef8690b101b4ea56d76a/zipp-0.6.0-py2.py3-none-any.whl Collecting more-itertools (from zipp>=0.5->importlib-metadata; python_version < "3.8"->jsonschema) Downloading https://files.pythonhosted.org/packages/68/03/0604cec1ea13c9f063dd50f900d1a36160334dd3cfb01fd0e638f61b46ba/more_itertools-8.0.2-py3-none-any.whl (40kB) 100% |████████████████████████████████| 40kB 3.5MB/s Installing collected packages: more-itertools, zipp, importlib-metadata, attrs, jsonschema Successfully installed attrs-19.3.0 importlib-metadata-1.3.0 jsonschema-3.2.0 more-itertools-8.0.2 zipp-0.6.0 $ silkaj Traceback (most recent call last): File "/home/simon/.local/bin/silkaj", line 20, in <module> from silkaj.cli_tools import cli File "/home/simon/.local/lib/python3.7/site-packages/silkaj/cli_tools.py", line 22, in <module> from silkaj.tx import send_transaction File "/home/simon/.local/lib/python3.7/site-packages/silkaj/tx.py", line 24, in <module> from silkaj.network_tools import ClientInstance, HeadBlock File "/home/simon/.local/lib/python3.7/site-packages/silkaj/network_tools.py", line 25, in <module> from duniterpy.api.client import Client File "/home/simon/.local/lib/python3.7/site-packages/duniterpy/api/client.py", line 9, in <module> import jsonschema File "/usr/local/lib/python3.7/dist-packages/jsonschema/__init__.py", line 11, in <module> from jsonschema.exceptions import ( File "/usr/local/lib/python3.7/dist-packages/jsonschema/exceptions.py", line 152, in <module> @attr.s(hash=True) AttributeError: module 'attr' has no attribute 's'
Je tourne en boucle...
Edited by Simon Lefort- Owner
You make it wrong by using
sudo pip
!sudo pip
install packages in your system ! Never use sudo for pip install !See that when you run silkaj, it is using the packages in your $HOME/.local folder...
So it seems that silkaj is installed in user mode, then you add missing packages in your system... It can not work.
To install silkaj locally, you can use
pip install --user silkaj
in your user directory:You can install silkaj properly in
$HOME/.local/bin
:pip install --user silkaj
then run it :
~/.local/bin/silkaj
Then you need to add the path
~/.local/bin
to your system PATH to simply runsilkaj
.https://stackoverflow.com/questions/42988977/what-is-the-purpose-pip-install-user
Or you can create a virtual environment:
I am using pyenv to choose my current python version:
pyenv shell 3.6.3
But you can use the python of your system. Let's try an install in a dedicated folder:
mkdir test_silkaj cd test_silkaj/
Then create a virtual environment to not pollute your system site-packages directory:
python -m venv test-silkaj-env source test-silkaj-env/bin/activate
The prompt display the virtualenv in which I am now:
(test-silkaj-env) vit@tower:/mnt/data/home/vit/Documents/dev/python/test_silkaj$ pip search silkaj silkaj (0.7.3) - Command line client for Duniter You are using pip version 9.0.1, however version 19.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
Install silkaj in the current virtualenv with all necessary dependencies:
pip install silkaj Collecting silkaj Downloading https://files.pythonhosted.org/packages/c7/0f/1387677c1b8b2ac93f22ccccc326e535fafec51ea57f809b7f70521371fa/silkaj-0.7.3-py3-none-any.whl (45kB) 100% |████████████████████████████████| 51kB 540kB/s Collecting texttable (from silkaj) Downloading https://files.pythonhosted.org/packages/82/a8/60df592e3a100a1f83928795aca210414d72cebdc6e4e0c95a6d8ac632fe/texttable-1.6.2.tar.gz Collecting pynacl (from silkaj) Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/27/15/2cd0a203f318c2240b42cd9dd13c931ddd61067809fee3479f44f086103e/PyNaCl-1.3.0-cp34-abi3-manylinux1_x86_64.whl (759kB) 100% |████████████████████████████████| 768kB 1.0MB/s Collecting duniterpy==0.54.3 (from silkaj) Downloading https://files.pythonhosted.org/packages/3d/e2/7571d37ee59f22efbe3ac32f93f8761bc5f82d389a4a43996ed7406e4910/duniterpy-0.54.3-py3-none-any.whl (111kB) 100% |████████████████████████████████| 112kB 2.2MB/s Collecting Click (from silkaj) Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl (81kB) 100% |████████████████████████████████| 81kB 698kB/s Collecting ipaddress (from silkaj) Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/c2/f8/49697181b1651d8347d24c095ce46c7346c37335ddc7d255833e7cde674d/ipaddress-1.0.23-py2.py3-none-any.whl Collecting tabulate (from silkaj) Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/c4/41/523f6a05e6dc3329a5660f6a81254c6cd87e5cfb5b7482bae3391d86ec3a/tabulate-0.8.6.tar.gz (45kB) 100% |████████████████████████████████| 51kB 3.5MB/s Collecting cffi>=1.4.1 (from pynacl->silkaj) Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/49/72/0d42f94fe94afa8030350c26e9d787219f3f008ec9bf6b86c66532b29236/cffi-1.13.2-cp36-cp36m-manylinux1_x86_64.whl (397kB) 100% |████████████████████████████████| 399kB 1.1MB/s Collecting six (from pynacl->silkaj) Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl Collecting pypeg2>=2.15.2 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/f9/bd/10398e2c2d2070cc8a9c7153abfbd4ddb2895a2c52a32722ab8689e0cc7d/pyPEG2-2.15.2.tar.gz Collecting pyaes>=1.6.1 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/44/66/2c17bae31c906613795711fc78045c285048168919ace2220daa372c7d72/pyaes-1.6.1.tar.gz Collecting base58>=1.0.0 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/09/b2/21ac9591f055acc145afead895edeb73bbd69d95cf366fc5c2233f2434cb/base58-1.0.3-py3-none-any.whl Collecting jsonschema>=2.6.0 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl Collecting attr>=0.3.1 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/de/be/ddc7f84d4e087144472a38a373d3e319f51a6faf6e5fc1ae897173675f21/attr-0.3.1.tar.gz Collecting pylibscrypt>=1.7.1 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/a5/00/9975628999c9eafd4c31545900b8fb82e7dc11a62a7193fc4ffa7a5096d9/pylibscrypt-1.8.0.tar.gz Collecting libnacl>=1.6.1 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/a6/4e/2575a1a37878159c1160ebc5e7d698b7f28de90441c246b51fdc5c894467/libnacl-1.7-py2.py3-none-any.whl Collecting aiohttp>=3.3.2 (from duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/7c/39/7eb5f98d24904e0f6d3edb505d4aa60e3ef83c0a58d6fe18244a51757247/aiohttp-3.6.2-cp36-cp36m-manylinux1_x86_64.whl Collecting pycparser (from cffi>=1.4.1->pynacl->silkaj) Cache entry deserialization failed, entry ignored Cache entry deserialization failed, entry ignored Downloading https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz (158kB) 100% |████████████████████████████████| 163kB 1.8MB/s Collecting importlib-metadata; python_version < "3.8" (from jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/e9/71/1a1e0ed0981bb6a67bce55a210f168126b7ebd2065958673797ea66489ca/importlib_metadata-1.3.0-py2.py3-none-any.whl Collecting attrs>=17.4.0 (from jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl Requirement already satisfied: setuptools in ./test-silkaj-env/lib/python3.6/site-packages (from jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Collecting pyrsistent>=0.14.0 (from jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/6c/6f/c1a2e8da80a0029f6b618d7e20e1a6f2a61dd04e2e54225309c2cc4268f7/pyrsistent-0.15.6.tar.gz Collecting idna-ssl>=1.0; python_version < "3.7" (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/46/03/07c4894aae38b0de52b52586b24bf189bb83e4ddabfe2e2c8f2419eec6f4/idna-ssl-1.1.0.tar.gz Collecting async-timeout<4.0,>=3.0 (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl Collecting multidict<5.0,>=4.5 (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Downloading https://files.pythonhosted.org/packages/24/d4/ce90c4376ed1bb34225419e11f649cfe5e95c56e64d5a8392d5e6e58bac6/multidict-4.7.3-cp36-cp36m-manylinux1_x86_64.whl (148kB) 100% |████████████████████████████████| 153kB 2.0MB/s Collecting chardet<4.0,>=2.0 (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl Collecting yarl<2.0,>=1.0 (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/95/8f/0209fc5d975f839344c33c822ff2f7ef80f6b1e984673a5a68f960bfa583/yarl-1.4.2-cp36-cp36m-manylinux1_x86_64.whl Collecting typing-extensions>=3.6.5; python_version < "3.7" (from aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/03/92/705fe8aca27678e01bbdd7738173b8e7df0088a2202c80352f664630d638/typing_extensions-3.7.4.1-py3-none-any.whl Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/74/3d/1ee25a26411ba0401b43c6376d2316a71addcc72ef8690b101b4ea56d76a/zipp-0.6.0-py2.py3-none-any.whl Collecting idna>=2.0 (from idna-ssl>=1.0; python_version < "3.7"->aiohttp>=3.3.2->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl Collecting more-itertools (from zipp>=0.5->importlib-metadata; python_version < "3.8"->jsonschema>=2.6.0->duniterpy==0.54.3->silkaj) Using cached https://files.pythonhosted.org/packages/68/03/0604cec1ea13c9f063dd50f900d1a36160334dd3cfb01fd0e638f61b46ba/more_itertools-8.0.2-py3-none-any.whl Installing collected packages: texttable, pycparser, cffi, six, pynacl, pypeg2, pyaes, base58, more-itertools, zipp, importlib-metadata, attrs, pyrsistent, jsonschema, attr, pylibscrypt, libnacl, idna, idna-ssl, async-timeout, multidict, chardet, yarl, typing-extensions, aiohttp, duniterpy, Click, ipaddress, tabulate, silkaj Running setup.py install for texttable ... done Running setup.py install for pycparser ... done Running setup.py install for pypeg2 ... done Running setup.py install for pyaes ... done Running setup.py install for pyrsistent ... done Running setup.py install for attr ... done Running setup.py install for pylibscrypt ... done Running setup.py install for idna-ssl ... done Running setup.py install for tabulate ... done Successfully installed Click-7.0 aiohttp-3.6.2 async-timeout-3.0.1 attr-0.3.1 attrs-19.3.0 base58-1.0.3 cffi-1.13.2 chardet-3.0.4 duniterpy-0.54.3 idna-2.8 idna-ssl-1.1.0 importlib-metadata-1.3.0 ipaddress-1.0.23 jsonschema-3.2.0 libnacl-1.7 more-itertools-8.0.2 multidict-4.7.3 pyaes-1.6.1 pycparser-2.19 pylibscrypt-1.8.0 pynacl-1.3.0 pypeg2-2.15.2 pyrsistent-0.15.6 silkaj-0.7.3 six-1.13.0 tabulate-0.8.6 texttable-1.6.2 typing-extensions-3.7.4.1 yarl-1.4.2 zipp-0.6.0 You are using pip version 9.0.1, however version 19.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
Run silkaj in the current virtualenv:
(test-silkaj-env) vit@tower:/mnt/data/home/vit/Documents/dev/python/test_silkaj$ silkaj Usage: silkaj [OPTIONS] COMMAND [ARGS]... Options: -h, --help Show this message and exit. -v, --version Show the version and exit. -p, --peer TEXT Default endpoint will reach Ğ1 currency with `https://g1.duniter.org` endpoint. Custom endpoint can be specified with `-p` option followed by <domain>:<port> -gt, --gtest ĞTest: `https://g1-test.duniter.org` endpoint --auth-scrypt, --scrypt Scrypt authentication: default method --nrp TEXT Scrypt parameters: defaults N,r,p: "4096,16,1" -af, --auth-file Authentication file. Defaults to: './authfile' --file TEXT Path file specification with '--auth-file' [default: authfile] --auth-seed, --seed Seed hexadecimal authentication --auth-wif, --wif WIF and EWIF authentication methods Commands: about Display program information argos Display currency information formatted for Argos or BitBar authfile Generate authentication file balance Get wallet balance blocks Display blocks: default: 0 for current window size cert Send certification diffi Display the current Proof of Work difficulty level to generate... history Display transaction history id Find corresponding identity or pubkey from pubkey or identity info Display information about currency license Display Ğ1 license net Display network view tx Send transaction wot Check received and sent certifications and consult the...
Problem solved.
Edited by Vincent Texier 1 - Moul changed title from attr error while installing with pip to attr error while installing with pip on Debian Buster
changed title from attr error while installing with pip to attr error while installing with pip on Debian Buster
Thanks vit!
sudo
usage is not specified in pip installation documentation.We should add a note (a warning) to prevent
sudo
usage withpip
.@matograine, could you confirm you were experimenting this issue while prefixing
pip
withsudo
?If this is the issue, the task of this ticket would be to add this note this in the documentation. You can assign yourself if you do not want to take it.
This part will be tackled in #298 (closed).
Edited by Moul- Moul changed title from attr error while installing with pip on Debian Buster to attr error while installing with pip, pip installation shouldn’t be 'sudo' prefixed
changed title from attr error while installing with pip on Debian Buster to attr error while installing with pip, pip installation shouldn’t be 'sudo' prefixed
May be an explanation on StackOverFlow on why it is happening.
Edited by Moul- Author Maintainer
I'll have a look at it, and update the doc.
- Moul assigned to @moul and unassigned @matograine
assigned to @moul and unassigned @matograine
Might be fixed by duniterpy!91 (merged).
- Author Maintainer
I just installed v0.7.4 without sudo on a testing fresh account on a Debian Buster, I get the same error:
$ pip3 install silkaj --user Collecting silkaj [...] $ silkaj -v Traceback (most recent call last): File "/home/sudo_account/.local/bin/silkaj", line 20, in <module> from silkaj.cli_tools import cli File "/home/bonjour/.local/lib/python3.7/site-packages/silkaj/cli_tools.py", line 22, in <module> from silkaj.tx import send_transaction File "/home/bonjour/.local/lib/python3.7/site-packages/silkaj/tx.py", line 24, in <module> from silkaj.network_tools import ClientInstance, HeadBlock File "/home/bonjour/.local/lib/python3.7/site-packages/silkaj/network_tools.py", line 25, in <module> from duniterpy.api.client import Client File "/home/bonjour/.local/lib/python3.7/site-packages/duniterpy/api/client.py", line 9, in <module> import jsonschema File "/home/bonjour/.local/lib/python3.7/site-packages/jsonschema/__init__.py", line 11, in <module> from jsonschema.exceptions import ( File "/home/bonjour/.local/lib/python3.7/site-packages/jsonschema/exceptions.py", line 152, in <module> @attr.s(hash=True) AttributeError: module 'attr' has no attribute 's'
so, this has nothing to do with
sudo
as I was thinking. - Author Maintainer
OK, apparently you just need to :
pip3 uninstall attr
More testing is required to check that all functions work correctly.
Edited by matograine - Owner