Installing ODrive Tool "No module named serial"


#1

Hi all,
in the documentation for installing phyton on a windows machine, a line should be added between point 3 (pip install pywin32) and 4 (pip install odrive). Otherwise the installation of ODrive tool will fail.

pip install pyserial

Greetings / Zennix


#2

Hm we set up PySerial to be a dependency during the pip installation, see here. Did you install odrivetool using pip?


#3

Hi Oscar,

yes I used pip install.
Description in getting-started.md with Anaconda.

Windows

  1. Install Python 3. We recommend the Anaconda distribution because it packs a lot of useful scientific tools, however you can also install the standalone python.
    • Anaconda: Download the installer from here. Execute the downloaded file and follow the instructions.
    • Standalone Python: Download the installer from here. Execute the downloaded file and follow the instructions.
    • If you have Python 2 installed alongside Python 3, replace pip by C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts\pip. If you have trouble with this step then refer to this walkthrough.
  2. Launch the command prompt.
    • Anaconda: In the start menu, type Anaconda Prompt Enter
    • Standalone Python: In the start menu, type cmd Enter
  3. Install dependencies by typing pip install pywin32==222 Enter
  4. Install the ODrive tools by typing pip install odrive Enter
  5. Plug in a USB cable into the microUSB connector on ODrive, and connect it to your PC.
  6. Use the Zadig utility to set ODrive driver to libusb-win32.
  • Check β€˜List All Devices’ from the options menu, and select β€˜ODrive 3.x Native Interface (Interface 2)’. With that selected in the device list choose β€˜libusb-win32’ from the target driver list and then press the large β€˜install driver’ button.

Greetings / Zennix


#4

Okay thanks. If someone else also gets the same issue, please comment here. If many people get the same problem, I’ll add a step in the instructions for this.


#5

I’m having the same issue on my ubuntu machine.


#6

When you run pip install odrive what is your output? I tried uninstalling PySerial, and then installing odrive. In my case pip will install pyserial as a dependency.
I get:

$ pip install odrive
Collecting odrive
Requirement already satisfied: pywin32==222 in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (222)
Requirement already satisfied: matplotlib in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (2.0.2)
Requirement already satisfied: requests in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (2.14.2)
Collecting PySerial (from odrive)
  Downloading https://files.pythonhosted.org/packages/0d/e4/2a744dd9e3be04a0c0907414e2a01a7c88bb3915cbe3c8cc06e209f59c30/pyserial-3.4-py2.py3-none-any.whl (193kB)
Requirement already satisfied: PyUSB in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (1.0.1)
Requirement already satisfied: IntelHex in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (2.2.1)
Requirement already satisfied: ipython in c:\users\oskar\anaconda3\lib\site-packages (from odrive) (5.3.0)
Requirement already satisfied: numpy>=1.7.1 in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (1.12.1)
Requirement already satisfied: six>=1.10 in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (1.10.0)
Requirement already satisfied: python-dateutil in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (2.6.0)
Requirement already satisfied: pytz in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (2017.2)
Requirement already satisfied: cycler>=0.10 in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in c:\users\oskar\anaconda3\lib\site-packages (from matplotlib->odrive) (2.1.4)
Installing collected packages: PySerial, odrive
Successfully installed PySerial-3.4 odrive-0.4.0.post1

#7

Here’s what I get on my ubuntu machine. Windows is doing the same thing for me also.

$ pip --verbose install odrive
Converted retries value: Retry(total=5, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=5, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None)
Converted retries value: Retry(total=5, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=5, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None)
Collecting odrive
  1 location(s) to search for versions of odrive:
  * https://pypi.python.org/simple/odrive/
  Getting page https://pypi.python.org/simple/odrive/
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/odrive/ HTTP/1.1" 301 122
  Starting new HTTPS connection (1): pypi.org
  "GET /simple/odrive/ HTTP/1.1" 200 839
  Analyzing links from page https://pypi.org/simple/odrive/
    Found link https://files.pythonhosted.org/packages/d5/a3/3d0e08849e95d33dc45fe4a2c488208cb7df381b01c1382f204768dfdc86/odrive-0.3.7.dev-0.tar.gz#sha256=094db513dbf178b9aa987e36cd6da9e6a67d1b751d51a9ad5dcb9cd1d8ba823a (from https://pypi.org/simple/odrive/), version: 0.3.7.dev-0
    Found link https://files.pythonhosted.org/packages/9e/f5/1cd78ee3cb20a48e88bb7021d90414f2447176f9005ffbf5d494e97734f7/odrive-0.3.7.dev-1.tar.gz#sha256=72e7ea1b5edf0daed8b06f7afabf92d1c1f5ebde68348af694a627e89a9a653a (from https://pypi.org/simple/odrive/), version: 0.3.7.dev-1
    Found link https://files.pythonhosted.org/packages/45/73/9f7ac77347cadf3547e4ef7eefd1c84d7708b4894aadd5f6dc3b9bab3a24/odrive-0.3.7.dev-2.tar.gz#sha256=c29485d4f0342b3e53057f4ad528aec9261ee6a0a2f1030ccdc754457dd0c44d (from https://pypi.org/simple/odrive/), version: 0.3.7.dev-2
    Found link https://files.pythonhosted.org/packages/f1/51/c9e60ec715684185d73be3c1ba3ec924ebbcd446bd52ac04656c659d57b0/odrive-0.3.7.dev-3.tar.gz#sha256=2e9c1e0c19e445c5c2fb4ff7f525ad33e31ea5a0d0fd2329093bdd3287be3111 (from https://pypi.org/simple/odrive/), version: 0.3.7.dev-3
    Found link https://files.pythonhosted.org/packages/25/92/8c479d860bb3feb5ba52a29cb27a43b93b8272f3d945780c3cf9ca748d22/odrive-0.4.0.tar.gz#sha256=c518be2f1150e277ee302a4c038cbee779d7014617e1c93ddbb85fb4c9fa178a (from https://pypi.org/simple/odrive/), version: 0.4.0
    Found link https://files.pythonhosted.org/packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz#sha256=e685c3210675a721ccb3f383f56db7dfe19119d318d46ad015dda09f9cb1af71 (from https://pypi.org/simple/odrive/), version: 0.4.0.post1
    Found link https://files.pythonhosted.org/packages/65/60/8ee4f2f019c2108dbb73e1cd07dad1e35645fe0188e3bc33bc185a5ee8d7/odrive-0.4.1.dev1.tar.gz#sha256=b3288148064945795196f4693b6c39f42f635fdee1a75c56a1306d088f641958 (from https://pypi.org/simple/odrive/), version: 0.4.1.dev1
  Using version 0.4.0.post1 (newest of versions: 0.4.0, 0.4.0.post1)
  Starting new HTTPS connection (1): files.pythonhosted.org
  "GET /packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz HTTP/1.1" 200 41225
  Downloading https://files.pythonhosted.org/packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz (41kB)
  Downloading from URL https://files.pythonhosted.org/packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz#sha256=e685c3210675a721ccb3f383f56db7dfe19119d318d46ad015dda09f9cb1af71 (from https://pypi.org/simple/odrive/)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51kB 647kB/s 
  Running setup.py (path:/tmp/pip-build-pqekvrad/odrive/setup.py) egg_info for package odrive
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-pqekvrad/odrive/setup.py", line 48, in <module>
        import odrive.version
      File "/tmp/pip-build-pqekvrad/odrive/odrive/__init__.py", line 8, in <module>
        import fibre
      File "/tmp/pip-build-pqekvrad/odrive/fibre/__init__.py", line 2, in <module>
        from .discovery import find_any, find_all
      File "/tmp/pip-build-pqekvrad/odrive/fibre/discovery.py", line 13, in <module>
        import fibre.serial_transport
      File "/tmp/pip-build-pqekvrad/odrive/fibre/serial_transport.py", line 10, in <module>
        import serial
    ImportError: No module named 'serial'
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pqekvrad/odrive/
Exception information:
Traceback (most recent call last):
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/commands/install.py", line 328, in run
    wb.build(autobuilding=True)
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/wheel.py", line 748, in build
    self.requirement_set.prepare_files(self.finder)
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/req/req_set.py", line 591, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/req/req_set.py", line 127, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/req/req_install.py", line 430, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/ben/pyEnvironments/ODrive/lib/python3.5/site-packages/pip/utils/__init__.py", line 736, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pqekvrad/odrive/
Converted retries value: Retry(total=0, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=0, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None)
Converted retries value: Retry(total=0, connect=None, read=None, redirect=None) -> Retry(total=Retry(total=0, connect=None, read=None, redirect=None), connect=None, read=None, redirect=None)
Starting new HTTPS connection (1): pypi.python.org
"GET /pypi/pip/json HTTP/1.1" 301 122
Starting new HTTPS connection (1): pypi.org
"GET /pypi/pip/json HTTP/1.1" 200 15796

#8

After installing pySerial, wheel, and pyUSB, I get:

$ pip install odrive
Collecting odrive
  Using cached https://files.pythonhosted.org/packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz
    Complete output from command python setup.py egg_info:
    you should run this as root, otherwise it will probably not work
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-94v2fket/odrive/setup.py", line 78, in <module>
        odrive.utils.setup_udev_rules(Logger())
      File "/tmp/pip-build-94v2fket/odrive/odrive/utils.py", line 154, in setup_udev_rules
        with open('/etc/udev/rules.d/50-odrive.rules', 'w') as file:
    PermissionError: [Errno 13] Permission denied: '/etc/udev/rules.d/50-odrive.rules'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-94v2fket/odrive/

#9

Okay thanks a lot, I think I know what the issue is from looking at that. It looks like the setup.py is at install-time, through some shims to fibre, including serial even though it’s not installed yet. We’ll look into breaking that false dependency on serial during install-time.

Can you try running sudo pip install odrive?


#10
$ sudo pip3 install odrive
The directory '/home/ben/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ben/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting odrive
  Downloading https://files.pythonhosted.org/packages/2f/62/c4a762a52c807969f61f9b0571455f474d8691c95df8555514b6097d8edb/odrive-0.4.0.post1.tar.gz (41kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51kB 731kB/s 
Collecting ipython (from odrive)
  Downloading https://files.pythonhosted.org/packages/b1/7f/91d50f28af3e3a24342561983a7857e399ce24093876e6970b986a0b6677/ipython-6.4.0-py3-none-any.whl (750kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 757kB 442kB/s 
Requirement already satisfied (use --upgrade to upgrade): PyUSB in ./.local/lib/python3.5/site-packages (from odrive)
Requirement already satisfied (use --upgrade to upgrade): PySerial in ./.local/lib/python3.5/site-packages (from odrive)
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python3/dist-packages (from odrive)
Collecting IntelHex (from odrive)
  Downloading https://files.pythonhosted.org/packages/bf/77/bf670318b3db325c71e2ac6a90b7bcfdf9fc739b7cf6aebb31715721623e/intelhex-2.2.1-py2.py3-none-any.whl (50kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51kB 584kB/s 
Collecting matplotlib (from odrive)
  Downloading https://files.pythonhosted.org/packages/81/31/4e261379e0cd4e9bbacfc96b124ebac0706b44374bd1d34ef899796f741b/matplotlib-2.2.2-cp35-cp35m-manylinux1_x86_64.whl (12.6MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 12.6MB 75kB/s 
Collecting pywin32==222; platform_system == "Windows" (from odrive)
  Could not find a version that satisfies the requirement pywin32==222; platform_system == "Windows" (from odrive) (from versions: )
No matching distribution found for pywin32==222; platform_system == "Windows" (from odrive)

I presume that pywin32 is not an actual dependency in this scenario? How can i kill that?


#11

This dependency should indeed be ignored on your Ubuntu machine. The odrive package does exactly what they say in the setuptools docs.
If updating pip does not fix the issue you can try sudo pip3 install odrive --no-deps. This will make pip ignore all dependencies. All correct dependencies should already be installed from previous attempts.


#12

It looks like we should have fixed this issue with PR #174, which I just released on the pip package version 0.4.0.post2.
Thanks @Samuel.


#13

Thanks. I still had to install pyserial, wheel and pyusb, but after that, odrive installed and runs fine.


#14

@madcowswe I had this same error with installing odrivetool via pip. Got a dependency error on pywin32, on an Ubuntu 16.04 machine.

I ran this just 1 day ago.


#15

I’m stuck here:

Collecting odrive

Downloading https://files.pythonhosted.org/packages/ca/e5/7f8fadbd57fa73c27cf0362aaf8d60f544a277cc48509381604450a7af71/odrive-0.4.1.tar.gz (41kB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51kB 27kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File β€œβ€, line 1, in
File β€œ/tmp/pip-install-8nYEGd/odrive/setup.py”, line 87, in
import odrive.utils
File β€œodrive/utils.py”, line 169
print(question, end=’’)
^
SyntaxError: invalid syntax

----------------------------------------

Command β€œpython setup.py egg_info” failed with error code 1 in /tmp/pip-install-8nYEGd/odrive/


#16

@dkraft Try using python 3 instead of python 2.