xsherlock Posted January 1, 2015 at 11:21 PM Share Posted January 1, 2015 at 11:21 PM Dear, I need apscheduler for my python program (quite useful bit) but pip is falling on the instalation. How do I make it install it. tf@red-brick:~$ pip install apscheduler Downloading/unpacking apscheduler Cannot fetch index base URL https://pypi.python.org/simple/ Could not find any downloads that satisfy the requirement apscheduler Cleaning up... No distributions at all found for apscheduler Storing debug log for failure in /home/tf/.pip/pip.log TIA Quote Link to comment Share on other sites More sharing options...
borg Posted January 1, 2015 at 11:35 PM Share Posted January 1, 2015 at 11:35 PM It works for me. You will need to run pip as root however: tf@red-brick:~$ sudo pip install apscheduler Collecting apscheduler Downloading APScheduler-3.0.1-py2.py3-none-any.whl (47kB) 100% |################################| 49kB 535kB/s Collecting six (from apscheduler) Downloading six-1.8.0-py2.py3-none-any.whl Collecting futures (from apscheduler) Downloading futures-2.2.0-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/lib/pytho n2.7/dist-packages (from apscheduler) Collecting tzlocal (from apscheduler) Downloading tzlocal-1.1.2.zip Installing collected packages: tzlocal, futures, six, apscheduler Running setup.py install for tzlocal Successfully installed apscheduler-3.0.1 futures-2.2.0 six-1.8.0 tzlocal-1.1.2 tf@red-brick:~$ Quote Link to comment Share on other sites More sharing options...
xsherlock Posted January 2, 2015 at 05:14 PM Author Share Posted January 2, 2015 at 05:14 PM Thanks, It was it as well as misconfigured DNS. but still no success in running the very same software that works fine on same setup when launched from the PC. 2015-01-02T18:09:40.316286+0100 ------------------------------------------------------------------------------- Traceback (most recent call last): File "Power logger.py", line 20, in <module> from apscheduler.schedulers.background import BackgroundScheduler ImportError: No module named apscheduler.schedulers.background What else could that be? It works in the win7 PC. #!/usr/bin/env python # -*- coding: utf-8 -*- HOST = "172.16.0.39" PORT = 4223 UID_lcd = "o73" # Change to your UID UID_poti = "fwV" UID_dual_button = "mEa" UID_dual_relay = "kDz" UID_voltage = "nNc" UID_step = "6RsbXm" UID_temp = "qnM" UID_nfc = "oEh" import binascii import time import datetime from datetime import datetime from apscheduler.schedulers.background import BackgroundScheduler from tinkerforge.ip_connection import IPConnection from tinkerforge.bricklet_lcd_20x4 import LCD20x4 from tinkerforge.bricklet_linear_poti import LinearPoti from tinkerforge.bricklet_dual_button import DualButton from tinkerforge.bricklet_dual_relay import DualRelay from tinkerforge.bricklet_voltage_current import VoltageCurrent from tinkerforge.brick_stepper import Stepper from tinkerforge.bricklet_temperature import Temperature from tinkerforge.bricklet_nfc_rfid import NFCRFID global running_time running_time=0 def cb_current(current): lcd.write_line(1, 0, str(round(current/1000.0,2)) + 'A ') voltage = vc.get_voltage() lcd.write_line(1, 14, str(round((voltage * current)/1000000.0,2)) + 'W ') def cb_voltage(voltage): lcd.write_line(1, 7, str(round(voltage/1000.0,2)) + 'V ') current = vc.get_current() lcd.write_line(1, 14, str(round((voltage * current)/1000000.0,2)) + 'W ') def cb_pressed(i): if i==0: # datetime.now().strftime('%Y-%m-%d %H:%M:%S') log_started = datetime.now().time() lcd.write_line(2, 0, 'Logging ' + datetime.now().strftime('%H:%M:%S')) sched.add_job(job_function, 'interval', seconds=1) global running_time running_time=0 if i==3: lcd.write_line(2, 0, 'Stopped ' ) time.sleep(2) lcd.write_line(2, 0, ' ' ) sched.remove_all_jobs() def job_function(): voltage = vc.get_voltage() current = vc.get_current() global running_time print(str(running_time+1)+','+datetime.now().strftime('%H:%M:%S') + ',' + str(round(voltage/1000.0,2)) + ',' + str(round(current/1000.0,2)) + ',' + str(round((voltage * current)/1000000.0,2))) running_time=running_time+1 if __name__ == "__main__": ipcon = IPConnection() # Create IP connection lcd = LCD20x4(UID_lcd, ipcon) # Create device object poti = LinearPoti(UID_poti, ipcon) db = DualButton(UID_dual_button, ipcon) # Create device object dr = DualRelay(UID_dual_relay, ipcon) vc = VoltageCurrent(UID_voltage, ipcon) stepper = Stepper(UID_step, ipcon) t = Temperature(UID_temp, ipcon) nfc = NFCRFID(UID_nfc, ipcon) ipcon.connect(HOST, PORT) # Connect to brickd Don't use device before ipcon is connected sched = BackgroundScheduler() sched.start() lcd.backlight_on()# Turn backlight on # Write "Hello World" lcd.register_callback(lcd.CALLBACK_BUTTON_PRESSED, cb_pressed) vc.set_current_callback_period(1000) vc.register_callback(vc.CALLBACK_CURRENT, cb_current) vc.set_voltage_callback_period(1000) vc.register_callback(vc.CALLBACK_VOLTAGE, cb_voltage) current = vc.get_current() voltage = vc.get_voltage() lcd.clear_display() lcd.write_line(0, 0, 'Curr Volt Power ') lcd.write_line(1, 0, str(round(current/1000.0,2)) + 'A ') lcd.write_line(1, 7, str(round(voltage/1000.0,2)) + 'V ') lcd.write_line(1, 14, str(round((voltage * current)/1000000.0,2)) + 'W ') lcd.write_line(3, 0, 'Start Stop') input('Press key to exit\n') # Use input() in Python 3 ipcon.disconnect() Quote Link to comment Share on other sites More sharing options...
borg Posted January 3, 2015 at 02:17 PM Share Posted January 3, 2015 at 02:17 PM Mhh, i am not sure, again it works for me: tf@red-brick:~$ python Python 2.7.3 (default, Mar 14 2014, 17:55:54) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from apscheduler.schedulers.background import BackgroundScheduler >>> No errors. Quote Link to comment Share on other sites More sharing options...
xsherlock Posted January 5, 2015 at 03:24 PM Author Share Posted January 5, 2015 at 03:24 PM Indeed when running the import from the python shell I also dont see the error. Just the software will not run if uploaded with the BrickV If I ssh into the brick and run it manualy in the terminal it will start fine. but then it will crash when i start a tread (with the scheduler) It looks that it half-works on the pytnon 2.7.3 but not on the 3.2.3 and my development PC has version 3.4.1. Is there a way to upgrade the python verison on the brick. Quote Link to comment Share on other sites More sharing options...
borg Posted January 6, 2015 at 11:55 AM Share Posted January 6, 2015 at 11:55 AM Can you make a minimal example that crashes, so i can try to get it running? It is possible to install Python 3.4 on Debian Wheezy (which we are using), but it is a bit of a hassle: http://www.extellisys.com/articles/python-on-debian-wheezy Quote Link to comment Share on other sites More sharing options...
xsherlock Posted March 8, 2015 at 12:04 AM Author Share Posted March 8, 2015 at 12:04 AM on the image 1.5 it works! I install apsscheduler with sudo pip install apscheduler and then it work with python ver 2.7.8 and that is what I do not understand why it does not work with 3.4.2. Do I need to instal apscheduler separately to 3.4.2 in the terminal? Maciej Quote Link to comment Share on other sites More sharing options...
photron Posted March 9, 2015 at 09:03 AM Share Posted March 9, 2015 at 09:03 AM If you installed apscheduler using pip, it'll probably be installed for Python2 only. Try installing it using pip3: sudo pip3 install apscheduler Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.