Python Forum
How to install modules for 2.7 (or sharing from 3.8))
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to install modules for 2.7 (or sharing from 3.8))
#1
Hello,

I have been dabbling in Python on and off for several years and have found a need to motivate me to learn more: (I have fairly extensive experience in VBA/SQL)

I have a X10 hardware home automation interface (CM15) which recently broke down, there are no replacements for it, but an alternative similar to it (CM19) exists, for which the usual driver (Mochad, written in C) does not work well.

I found Python software for the CM19: https://github.com/trrroy/cm19a/blob/mas...aDriver.py which I would like to modify.
The program allows to switch a light (Amongst some other things) on an off from the command line. It is reloaded for every command.
In 2.7, I found that it did what is said it would, notably communicate via USB with the hardware.

My first step was to convert it from Python 2.7 ( to Python 3.8.
In 3.8 it works every 2nd time (systematically.) only

The only differences in the 2.7 and 3.8 code are print and except statements, which do not seem related to my problem.
However, in 2.7 worked with pyUSB 1.0, 3.8 with pyUSB 1.2

To see the functioning of 2.7 with pyUSB 1.2, I uninstalled pyUSB 1.0 after this running the program with 2.7 shows
ImportError: no module named usb
All attempts, to install puUSB (1.2 or 1.0) including installing in a 2.7 virtual environment, show "Requirement already satisfied: pyUSB in /usr.local/lib/python3.8/dist-packages (1.2.1)" but using 2.7 it is not found?

Uninstalling 3.8 to start from scratch created dire warnings, I did not go-ahead. (I am on Linux Mint 20)

Thanks in advance for any help or advise
Pete
Reply
#2
you can force pip to install an earlier version of pyusb.
Here are the release versions: https://pypi.org/project/pyusb/#history
use pip install pyusb==1.0.0a2 Change version number to desired version.
Reply
#3
Thank you for that: I can now see that pyUSB 1.0.2 gives the same results as pyUSB 1.2 with python 3.8 (program works only every second time it is run) so I have to look elsewhere for this bug.

(After I changed use dict.iteritems() -removed from python 3- to dict.items() the program ran OK every time.)

Pete



(Dec-30-2021, 03:35 AM)Larz60+ Wrote: you can force pip to install an earlier version of pyusb.
Here are the release versions: https://pypi.org/project/pyusb/#history
use pip install pyusb==1.0.0a2 Change version number to desired version.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Best way to secure API key when sharing quarinteen 2 352 Jan-19-2024, 04:46 PM
Last Post: deanhystad
  Sharing imported modules with Sub Processes? Stubblemonster 2 1,515 May-02-2022, 06:42 AM
Last Post: Stubblemonster
  multiprocessing and sharing object cyrduf 0 2,057 Feb-02-2021, 08:16 PM
Last Post: cyrduf
  sharing variables between two processes Kiyoshi767 1 1,877 Nov-07-2020, 04:00 AM
Last Post: ndc85430
  Sharing my code emirasal 2 2,048 Oct-04-2020, 02:21 PM
Last Post: emirasal
  Sharing X Axis in Sub plots JoeDainton123 1 2,189 Aug-22-2020, 04:11 AM
Last Post: deanhystad
  Instances sharing attributes midarq 4 2,493 Sep-20-2019, 11:13 AM
Last Post: midarq
  Can't decide - install modules with Ubuntu package manager (apt) or pip3 in venv Thisisaline 6 3,816 Jul-19-2019, 04:58 PM
Last Post: snippsat
  Sharing variables across modules j.crater 4 3,459 Jul-30-2018, 09:09 PM
Last Post: j.crater
  Modules issue, pip3 download modules only to pyhton3.5.2 not the latest 3.6.1 bmohanraj91 6 8,462 May-25-2017, 08:15 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020