Python Forum
Can't install nor import delorean module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't install nor import delorean module
#1
Good Friday evening to you all Pythoners. I believe this is my first post here in your forums and hope this is the correct place for it.
I'm using Jupyter notebook in VSCode and am trying to import the delorean module.
I've added it to a requirements.txt file ->

Quote:delorean==1.0.0
requests==2.22.0

and install it from the terminal thus ->
pip install -r requirements.txt

It starts to build everything fine and then I get the following error message:

Quote:ERROR: Command errored out with exit status 1:
command: /home/technodiver/CustomScripts/python/webscraping/pythonAutomation/chapt1/.venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cuxxdi7p/delorean/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cuxxdi7p/delorean/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-siiztfye
cwd: /tmp/pip-install-cuxxdi7p/delorean/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for delorean

BUT, after that it says that delorean was installed :

Quote: Running setup.py clean for delorean
Failed to build delorean
Installing collected packages: pytz, babel, humanize, six, python-dateutil, backports.zoneinfo, tzdata, pytz-deprecation-shim, tzlocal, delorean, chardet, idna, urllib3, certifi, requests
Running setup.py install for delorean ... done
Successfully installed babel-2.9.1 backports.zoneinfo-0.2.1 certifi-2021.10.8 chardet-3.0.4 delorean-1.0.0 humanize-3.12.0 idna-2.8 python-dateutil-2.8.2 pytz-2021.3 pytz-deprecation-shim-0.1.0.post0 requests-2.22.0 six-1.16.0 tzdata-2021.4 tzlocal-4.0.1 urllib3-1.25.11

When I try to import it I get the ModuleNotFoundError that I'm sure you're all familiar with and won't repeat it.

Can someone give me a clue to what's happening and more importantly - how to fix it?? Thank you

PS When I had delorean installed in another directory, in a different venv it installed without issue, and I still got the module not found error when I tried to import it. checking the install it told me all requirements were already satisfied but it wouldn't import. That's when I deactivated and deleted that venv, made it in another directory and now get that long error message.
Reply
#2
try (from command line): pip install delorean
then to see if it's properly installed: pip list
you can then update your requirements.txt with: pip freeze > requirements.txt
Tek likes this post
Reply
#3
It try to build wheel then it will use setup.py and should work with that to.
So can first try pip install wheel,but should not get that error message doing that,so something else is wrong.

Here a quick run and name your virtual environment so no conflict occurs.
# Make
tom@tom-VirtualBox:~$ python -m venv del_env
tom@tom-VirtualBox:~$ cd del_env/
# Activate 
tom@tom-VirtualBox:~/del_env$ source bin/activate

# Make requirements.txt
(del_env) tom@tom-VirtualBox:~/del_env$ vi requirements.txt
(del_env) tom@tom-VirtualBox:~/del_env$ cat requirements.txt 
delorean==1.0.0
requests==2.22.0
(del_env) tom@tom-VirtualBox:~/del_env$ ls
bin  include  lib  lib64  pyvenv.cfg  requirements.txt

# Install
(del_env) tom@tom-VirtualBox:~/del_env$ pip install -r requirements.txt 
Collecting delorean==1.0.0
  Downloading Delorean-1.0.0.tar.gz (18 kB)
.....
Using legacy 'setup.py install' for delorean, since package 'wheel' is not installed.
Installing collected packages: tzdata, six, pytz-deprecation-shim, pytz, urllib3, tzlocal, python-dateutil, idna, humanize, chardet, certifi, babel, requests, delorean
    Running setup.py install for delorean ... done
Successfully installed babel-2.9.1 certifi-2021.10.8 chardet-3.0.4 delorean-1.0.0 humanize-3.12.0 idna-2.8 python-dateutil-2.8.2 pytz-2021.3 pytz-deprecation-shim-0.1.0.post0 requests-2.22.0 six-1.16.0 tzdata-2021.4 tzlocal-4.0.1 urllib3-1.25.11 

# Test that it work
[python]Python 3.9.6 (default, Aug  3 2021, 16:49:17) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from delorean import Delorean
>>>
>>> d = Delorean()
>>> d
Delorean(datetime=datetime.datetime(2021, 10, 23, 9, 17, 26, 848343), timezone='UTC')
See that this message comes legacy 'setup.py install' for delorean, since package 'wheel' is not installed.,
so even without wheel installed it should work as it use setup.py install.

Pendulum is better choice as delorean don't get updated enough.
Reply
#4
(Oct-23-2021, 10:02 AM)snippsat Wrote: Pendulum is better choice as delorean don't get updated enough.

Thanks for your replies I believe I have it working now. I'm going to continue using Delorean as it's being used in the tutorial I'm working through at the moment. I'll be looking into Pendulum when I'm move familiar with things. I appreciate your help
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  is import cointegration_analysis a recognized module mitcht33 1 385 Nov-06-2023, 09:29 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 1,260 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 683 Aug-06-2023, 01:09 AM
Last Post: aupres
  import module error tantony 5 3,380 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Import a module one step back of the path prathampatel9 1 1,036 Sep-21-2022, 01:34 PM
Last Post: snippsat
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 10,492 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  Import a module for use in type hint? Milosz 0 1,455 Nov-08-2021, 06:49 PM
Last Post: Milosz
  import module with syntax error Skaperen 7 5,163 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  'urllib3' Module not found when import 'requests' spanz 5 9,963 Jan-06-2021, 05:57 PM
Last Post: snippsat
  Unable to install module rrowhe4d 1 2,255 Oct-13-2020, 10:20 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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