# Error cannot import name \_remove\_dead\_weakref

**URL:** <https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806>\
**Category:** Help\
**Created:** [October 12, 2020, 9:37am UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806 "2020-10-12T09:37:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![neodjandre](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/neodjandre/32/43589_2.png) [@neodjandre](https://community.letsencrypt.org/u/neodjandre)\
**Post date:** [October 12, 2020, 9:37am UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806/1 "2020-10-12T09:37:26Z")

</div>

I am running Ubuntu 18.04 and I am getting this error:

```
Error: couldn't get currently installed version for
 /opt/[eff.org/certbot/venv/bin/letsencrypt](http://eff.org/certbot/venv/bin/letsencrypt):
Traceback (most recent call last):
  File "/opt/[eff.org/certbot/venv/bin/letsencrypt](http://eff.org/certbot/venv/bin/letsencrypt)", line 7, in <module>
    from certbot.main import main
  File
 "/opt/[eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py](http://eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py)", line 2, in <module>
    from certbot._internal import main as internal_main
  File
 "/opt/[eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/_internal/main.py](http://eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/_internal/main.py)", line 6, in <module>
    import logging.handlers
  File "/usr/lib/python2.7/logging/ __init__.py", line 26, in <module>
    import sys, os, time, cStringIO, traceback, warnings, weakref,
 collections
  File "/usr/lib/python2.7/weakref.py", line 14, in <module>
    from _weakref import (
ImportError: cannot import name _remove_dead_weakref

```

Not sure why this started happening. Any help would be much appreciated.

Many thanks,  
Andreas

---

<div class="post-metadata">

**Author:** ![\_az](https://avatars.discourse-cdn.com/v4/letter/_/22d042/32.png) [@\_az](https://community.letsencrypt.org/u/_az)\
**Post date:** [October 12, 2020, 9:41am UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806/2 "2020-10-12T09:41:00Z")

</div>

Hi Andreas,

If you recently upgraded to Ubuntu 18.04 from an older version, you may need to delete the certbot-auto virtual environment and allow it to be automatically recreated:

```
sudo rm -rf /opt/eff.org/certbot
```

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [October 12, 2020, 2:52pm UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806/3 "2020-10-12T14:52:00Z")

</div>

If you could, try then installing `certbot` via `snapd`:

> **[Certbot](https://certbot.eff.org/)**
>
> Automatically enable HTTPS on your website with EFF's Certbot, deploying Let's Encrypt certificates.

  
 ![image](https://global.discourse-cdn.com/letsencrypt/original/3X/8/4/841b2b75620706199b37e8fff837780091b8f7de.png)

---

<div class="post-metadata">

**Author:** ![neodjandre](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/neodjandre/32/43589_2.png) [@neodjandre](https://community.letsencrypt.org/u/neodjandre)\
**Post date:** [October 14, 2020, 10:27am UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806/4 "2020-10-14T10:27:00Z")

</div>

ok this has suppressed the error, thank you 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [November 13, 2020, 10:27am UTC](https://community.letsencrypt.org/t/error-cannot-import-name-remove-dead-weakref/135806/5 "2020-11-13T10:27:10Z")

</div>

Closed on November 13, 2020, 10:27am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
