1

I am new to python world. I am trying to install plotly to explore visualization. I installed pip. upgraded it. after that, I downloaded plotly. However, while importing it, it still shows error.

!python -m pip install --upgrade pip

It showed,

Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.0.3
    Uninstalling pip-7.0.3:
      Successfully uninstalled pip-7.0.3
  Rolling back uninstall of pip
You are using pip version 7.0.3, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\basecommand.py", line 223, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\commands\install.py", line 297, in run
    root=options.root_path,
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\req\req_set.py", line 622, in install
    **kwargs
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\req\req_install.py", line 808, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\req\req_install.py", line 1003, in move_wheel_files
    isolated=self.isolated,
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\wheel.py", line 449, in move_wheel_files
    generated.extend(maker.make(spec))
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\_vendor\distlib\scripts.py", line 323, in make
    self._make_script(entry, filenames, options=options)
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\_vendor\distlib\scripts.py", line 227, in _make_script
    self._write_script(scriptnames, shebang, script, filenames, ext)
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\_vendor\distlib\scripts.py", line 163, in _write_script
    launcher = self._get_launcher('t')
  File "C:\Python27\lib\site-packages\pip-7.0.3-py2.7.egg\pip\_vendor\distlib\scripts.py", line 302, in _get_launcher
    result = finder(distlib_package).find(name).bytes
AttributeError: 'NoneType' object has no attribute 'bytes'

I upgraded pip,

!python -m pip install --upgrade pip

it shows,

Requirement already up-to-date: pip in c:\python27\lib\site-packages

After,

!pip install plotly --upgrade

it showed,

Requirement already up-to-date: plotly in c:\python27\lib\site-packages
Requirement already up-to-date: requests in c:\python27\lib\site-packages (from plotly)
Collecting six (from plotly)
  Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already up-to-date: pytz in c:\python27\lib\site-packages (from plotly)
Installing collected packages: six
  Found existing installation: six 1.9.0
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
Successfully installed six-1.10.0
You are using pip version 7.0.3, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

when I am importing plotly,

import plotly

It shows,

No module named plotly

I aplogozise for the long question. But how should I deal with this? Is there something to do with API key?

I generated my API key and tried with

plotly.tools.set_credentials_file(username='DemoAccount', api_key='hcv50j3UCMhj6Q0iRXZr')

it says plotly is not defined. is it the correct syntax? Can someone please tell me step by step process roght from pip? Is there other way around?

Thank you.

1 Answer 1

2

Here's a few things to try. I can vouch for the fact that pip is a genuine pain-in-the-ass to deal with sometimes, so it's not just you. I can't tell if you're using a virtual environment, but if you're not, using one will solve many of your problems. It appears you're using Windows, which I'm not super familiar with, so this might now work since I haven't tested this technique on Windows. I'm just going to forge ahead and do my best to translate this for the Windows user.

After you ran your pip install and pip told you the requirement was already satisfied it told you exactly where your pip modules were being installed. It is here: c:\python27\lib\site-packages. Without a nice safe virtual environment python doesn't know where to look for installed site packages. Correct this by setting the PYTHONPATH environment variable by following the instructions here. If you set the PYTHONPATH to the path indicated by pip, I think this SHOULD fix your problem. I'd love to know how this goes. I know you asked this question a few days ago, so I hope I'm not too late to help!

Sign up to request clarification or add additional context in comments.

2 Comments

It worked! I set up my path where site packages were and imported plotly. Thanks.
I'd be grateful if you accepted my answer as the correct one and gave it an upvote :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.