kmadac / bitstamp-python-client

Python package to communicate with bitstamp.net
MIT License
143 stars 70 forks source link

Module error after installation #23

Closed sunilsankar closed 6 years ago

sunilsankar commented 6 years ago

Getting Module error [root@docker ~]# pip3.6 freeze BitstampClient==2.2.0 certifi==2017.11.5 chardet==3.0.4 decorator==4.1.2 idna==2.6 ipython==6.2.1 ipython-genutils==0.2.0 jedi==0.11.0 parso==0.1.0 pexpect==4.3.0 pickleshare==0.7.4 prompt-toolkit==1.0.15 ptyprocess==0.5.2 Pygments==2.2.0 requests==2.18.4 simplegeneric==0.8.1 six==1.11.0 traitlets==4.3.2 urllib3==1.22 wcwidth==0.1.7 [root@docker ~]#

Traceback (most recent call last): File "./bitstamp.py", line 4, in import bitstamp.client File "/root/bitstamp.py", line 4, in import bitstamp.client ModuleNotFoundError: No module named 'bitstamp.client'; 'bitstamp' is not a package [root@docker ~]#

kmadac commented 6 years ago

Hi,

i just tried do the same in virtualenv on Ubuntu 16.04 and I do not have any problem to import bitstamp.client in python3.6.

kmadac@vajko:~/PycharmProjects/BitStamp-client$ . /tmp/bclenv/bin/activate
(bclenv) kmadac@vajko:~/PycharmProjects/BitStamp-client$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (38.2.4)
wheel (0.30.0)
(bclenv) kmadac@vajko:~/PycharmProjects/BitStamp-client$ pip install BitstampClient
Collecting BitstampClient
  Downloading BitstampClient-2.2.0.tar.gz
Collecting requests (from BitstampClient)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->BitstampClient)
  Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
    100% |████████████████████████████████| 337kB 522kB/s 
Collecting urllib3<1.23,>=1.21.1 (from requests->BitstampClient)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->BitstampClient)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->BitstampClient)
  Using cached idna-2.6-py2.py3-none-any.whl
Building wheels for collected packages: BitstampClient
  Running setup.py bdist_wheel for BitstampClient ... done
  Stored in directory: /home/kmadac/.cache/pip/wheels/c3/06/1d/e5633cb8901e003db6c7e465c3de77ba5a38b08ba2994a6859
Successfully built BitstampClient
Installing collected packages: certifi, urllib3, chardet, idna, requests, BitstampClient
Successfully installed BitstampClient-2.2.0 certifi-2017.11.5 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22
kmadac@vajko:~/PycharmProjects/BitStamp-client$ . /tmp/bclenv/bin/activate
(bclenv) kmadac@vajko:~$ python
Python 3.6.2 (default, Jul 17 2017, 23:14:31) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bitstamp
>>> import bitstamp.client
>>> 
>>> bitstamp.client
<module 'bitstamp.client' from '/tmp/bclenv/lib/python3.6/site-packages/bitstamp/client.py'>

Are you sure you run python3.6 when you tried to import bitstamp.client?

sunilsankar commented 6 years ago

Hi this is centos7 , I experienced the same in python2.7 default version available on centos7

kmadac commented 6 years ago

It seems that you used pip for python 3.6 but then you used other version of python (like python 2.7) when you tried to import it. You have to use python3.6. What python version you used is missing in your snippet.

sunilsankar commented 6 years ago

@kmadac I tried both 2.7 and 3.6 both dont work :(

tzachshabtay commented 6 years ago

@kmadac having the same issue. Ubuntu 16.04 using python 2.7 (not using virtualenv). pip freeze returns BitstampClient==2.2.1, pip version: pip 9.0.1 from /usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg (python 2.7).

Error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/tshabtay/Git/ck_crypto/balances/balances.py", line 2, in <module>
    import bitstamp.client
ImportError: No module named client
kmadac commented 6 years ago

Can you guys run pip show BitstampClient?

tzachshabtay commented 6 years ago

Name: BitstampClient Version: 2.2.1 Summary: Bitstamp API python implementation Home-page: https://github.com/kmadac/bitstamp-python-client Author: Kamil Madac Author-email: kamil.madac@gmail.com License: MIT Location: /usr/local/lib/python2.7/dist-packages Requires: requests

stoich350 commented 6 years ago

Hey all, i'm new to Python so i'm no guru at all. I had the exact same issue when my test script was called bitstamp.py Found a post of someone else having a similar issue with another module due to a name conflict and I renamed script file to pleasework.py and it worked! Just in case someone comes on here looking for a solution this was my simple solution and it looks like the OP is also calling his script bitstamp.py

sunilsankar commented 6 years ago

Thanks @stoich350 you are right , I renamed my script and now it is working great.