GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Importing imp in standard_library raises a PendingDeprecationWarning · Issue #246 · PythonCharmers/python-future

Importing imp in standard_library raises a PendingDeprecationWarning #246

New issue
Copy link
New issue
Copy link
Open
Open
Importing imp in standard_library raises a PendingDeprecationWarning#246
Copy link
Labels
needs-triage

Description

@jfinkels
jfinkels
opened on Oct 20, 2016
Issue body actions

The imp package is pending deprecation in favor of importlib as of Python 3.4.

$ python3.5 -Wonce -c "import future.standard_library"
[...]/lib/python3.5/site.py:165: DeprecationWarning: 'U' mode is deprecated
  f = open(fullname, "rU")
[...]/lib/python3.5/site-packages/future/standard_library/__init__.py:66: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

The recommended alternative is described here.

Reacted by Jon Dufresne and yonran

Activity

  1. skoranda
    added a commit that references this issue on Dec 4, 2018

    Suppress a warning due to python-future

    65a4751
  2. jmadler
    added
    needs-triage
    on May 6, 2019
  3. gGonz commented on Feb 15, 2020

    @gGonz
    gGonz
    on Feb 15, 2020
    More actions

    Any hope to get this fixed? Still happening after 3 years.

    Reacted by Ferdinand Schlatt
    Reacted by Ferdinand Schlatt and Dooley_labs
  4. elderlabs commented on Nov 21, 2021

    @elderlabs
    elderlabs
    on Nov 21, 2021
    More actions

    Assuming no one has plans to fix this? Currently tracking the source of a DeprecationWarning and found this along the way.

    Editing in an idea here, but what's the potential cost of importing imp in conditions requiring Python2 only, with a workaround for situations requiring it in Python3? Python 3.12 will drop all support for imp. Given there are several libraries in the wild that actively depend on python-future for the sole purpose of maintaining Py2 support, I'd like to find a fix in as efficient a manner as possible.

    I'd work out a solution myself, but I'm not working with python-future directly, but rather as a dependency of python-whois. Working out a solution on my own risks breaking something, as I'm not using python-future directly. Thanks.

  5. elderlabs commented on Mar 31, 2023

    @elderlabs
    elderlabs
    on Mar 31, 2023
    More actions

    Greetings again from the future. We're now in the days of Python 3.11, with Python 3.12's release looming ever closer. There is an open PR (#574) from 2019 to close this issue.

    Is python-future dead? Once Python 3.12 releases, this project will be left in a forever broken state if not updated.
    Please merge the pending PR.

    EDIT 2: Updating my previous edit, it would seem the imp module deprecation is still present in 0.18.3. Will this ever be fixed?

  6. hugovk commented on May 11, 2023

    @hugovk
    hugovk
    on May 11, 2023
    More actions

    The imp module has now been removed from Python 3.12.

    • Remove more deprecated importlib APIs from Python 3.12 python/cpython#98040
    • gh-98040: Remove just the imp module python/cpython#98573

    Python 3.12 will be in beta in two weeks, and set for release on 2023-10-02 and this library is one of the top 5,000 most-downloaded from PyPI.

    Please could you upgrade to use importlib? The imp docs have suggestions on what to use to replace each function and constant.

    Reacted by Dooley_labs
  7. yonran commented on Oct 11, 2023

    @yonran
    yonran
    on Oct 11, 2023
    More actions

    For people googling, in python 3.12, importing future.standard_library raises “ModuleNotFoundError: No module named 'imp'”:

    ImportError: Failed to import test module: myfile
    Traceback (most recent call last):
      …
      File "myfile.py", line 41, in <module>
        from future import standard_library
      File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/future/standard_library/__init__.py", line 65, in <module>
        import imp
    ModuleNotFoundError: No module named 'imp'
    

    In my case, I resolved the error by replacing those imports that need future.standard_library.install_aliases() with six instead (see imports2):

    • urllib.parse --> six.moves.urllib.parse
    • urllib.error --> six.moves.urllib.error
    • urllib.parse -->six.moves.urllib.parse
    • dbm.ndbm --> six.moves. dbm_ndbm
    • http.server --> six.BaseHTTPServer, six.CGIHTTPServer, or six.SimpleHTTPServer
    • tkinter.filedialog --> six.tkinter_tkfiledialog
    • tkinter.simpledialog --> six.tkinter_simpledialog
    • xmlrpc.server --> six.xmlrpc_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.