# Upgrade from v9 to v10

**URL:** <https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274>\
**Category:** Administrators\
**Created:** [10 January 2023 08:15 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274 "2023-01-10T08:15:27Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [10 January 2023 08:15 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/1 "2023-01-10T08:15:28Z")

</div>

Hello!!  
I want to upgrade from v9 to v10 using the [documentation](https://inveniordm.docs.cern.ch/releases/upgrading/upgrade-v10.0/). But in the Re-index data section, the commands are not known by the system even so i am in “my-site” directory.  
can anybody help ?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![nitarocc](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/n/9e8a1a/32.png) [@nitarocc](https://invenio-talk.web.cern.ch/u/nitarocc)\
**Post date:** [10 January 2023 10:44 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/2 "2023-01-10T10:44:51Z")

</div>

Hello,  
do you have the latest version of `invenio-cli`?

```auto
$ pip show invenio-cli
Name: invenio-cli
Version: 1.0.14

```

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [10 January 2023 12:29 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/3 "2023-01-10T12:29:37Z")

</div>

I have the version 1.0.4

---

<div class="post-metadata">

**Author:** ![nitarocc](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/n/9e8a1a/32.png) [@nitarocc](https://invenio-talk.web.cern.ch/u/nitarocc)\
**Post date:** [10 January 2023 12:58 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/4 "2023-01-10T12:58:39Z")

</div>

You will need to upgrade, see the step [Upgrade your invenio-cli](https://inveniordm.docs.cern.ch/releases/upgrading/upgrade-v10.0/#upgrade-steps), the first step in the upgrade guide.

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [10 January 2023 13:09 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/5 "2023-01-10T13:09:41Z")

</div>

I did that, but i still have the version 1.0.4

---

<div class="post-metadata">

**Author:** ![nitarocc](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/n/9e8a1a/32.png) [@nitarocc](https://invenio-talk.web.cern.ch/u/nitarocc)\
**Post date:** [10 January 2023 13:22 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/6 "2023-01-10T13:22:14Z")

</div>

I am not sure what is the command that you have used, I suggest the following:

```auto
$ pip uninstall -y invenio-cli
$ pip install invenio-cli

```

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [10 January 2023 13:37 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/7 "2023-01-10T13:37:46Z")

</div>

thanks, it’s working.

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [11 January 2023 08:29 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/8 "2023-01-11T08:29:57Z")

</div>

I got an error when i run `pipenv run invenio alembic upgrade`

```auto
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/bin/invenio", line 8, in <module>
    sys.exit(cli())
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask/cli.py", line 357, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask_alembic/cli/click.py", line 91, in upgrade
    base.upgrade(target)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask_alembic/cli/base.py", line 85, in upgrade
    get_alembic().upgrade(target)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask_alembic/extension.py", line 327, in upgrade
    self.run_migrations(do_upgrade)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask_alembic/extension.py", line 236, in run_migrations
    env.run_migrations(**kwargs)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/alembic/runtime/environment.py", line 865, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/alembic/runtime/migration.py", line 611, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/flask_alembic/extension.py", line 325, in do_upgrade
    return self.script_directory._upgrade_revs(target, revision)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/alembic/script/base.py", line 439, in _upgrade_revs
    return [
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/openmrs/.local/share/virtualenvs/invenio-YWY9aZyz/lib/python3.8/site-packages/alembic/script/base.py", line 267, in _catch_revision_errors
    raise util.CommandError(err.args[0]) from err
alembic.util.exc.CommandError: Requested revision 41157f1933d6 overlaps with other requested revisions eb9743315a9d

```

---

<div class="post-metadata">

**Author:** ![maadeoli](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@maadeoli](https://invenio-talk.web.cern.ch/u/maadeoli)\
**Post date:** [11 January 2023 13:19 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/9 "2023-01-11T13:19:20Z")

</div>

Hello!

Did you try to restore the database at some point?

Can you provide us with the current migrations installed in your system? We can have a look and take it from there. To do so, run the following commands:

List current heads:

```plaintext
invenio alembic heads

```

then access the database and list all the alembic versions:

```plaintext
psql -U <name_of_your_instance>

<instance_name>=# SELECT * FROM alembic_version;

```

lastly, paste both results here.

Thank you! 🙂

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [11 January 2023 14:15 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/10 "2023-01-11T14:15:00Z")

</div>

`invenio alembic heads`

```auto
dbdbc1b19cf2 -> 35c1075e6360 (default) (effective head), Force naming convention.
2da9a03b0833 (2e97565eba72, 862037093962) -> 1ba76da94103 (default, invenio_records_files) (head), Create records files tables.
676dd587542d -> e1146238edd3 (invenio_vocabularies) (head), Create awards table.
862037093962 -> 07fb52561c5c (invenio_records) (head), Alter column from json to jsonb.
bff1f190b9bd (62efc52773d4) -> aaa265b0afa6 (default, invenio_oauthclient) (head), Move UserIdentity to accounts.
dbe499bfda43 -> 04480be1593e (invenio_access) (head), Add ActionSystemRoles.
5b478fe7ef7f -> a3f5a8635cbb (invenio_communities) (head), Remove version table.
12a88921ada2 -> 4e57407b8e4a (default, invenio_oauth2server) (head), Add on delete cascade.
8ae99b034410 -> a29271fd78f8 (invenio_files_rest) (head), Create files object partial unique index.
e655021de0de -> 5d25c1981985 (invenio_oaiserver) (head), Add system_created field.
5cd30a3503c9 -> a14fa442680f (invenio_requests) (effective head), Create tables.
8ed1a438601c, 88d1463de5c0 (de9c14cbb0b2, a14fa442680f) -> 9e0ac518b9df (invenio_rdm_records) (head) (mergepoint), Create records/communities M2M table.
88d1463de5c0 -> a3957490361d (invenio_rdm_records) (head), Remove PIDRelations tables.
62efc52773d4 -> eb9743315a9d (invenio_accounts) (effective head), Add user profile and preferences as JSON fields to the User table.
f615cee99600 -> 999c62899c20 (invenio_pidstore) (head), Create pidstore tables.
c25ef2c50ffa (eb9743315a9d) -> 41157f1933d6 (invenio_userprofiles) (head), Remove table.

```

and

`SELECT * FROM alembic_version`

```auto
version_num
--------------
 1ba76da94103
 9e0ac518b9df
 a3957490361d
 4e57407b8e4a
 a29271fd78f8
 e655021de0de
 04480be1593e
 999c62899c20
 07fb52561c5c
 a3f5a8635cbb
 aaa265b0afa6
 eb9743315a9d
 41157f1933d6
 e1146238edd3

```

---

<div class="post-metadata">

**Author:** ![maadeoli](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/m/4bbf92/32.png) [@maadeoli](https://invenio-talk.web.cern.ch/u/maadeoli)\
**Post date:** [12 January 2023 13:31 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/11 "2023-01-12T13:31:37Z")

</div>

> [@GabomaGeek](#):
>
> ```auto
> 1ba76da94103
> 9e0ac518b9df
> a3957490361d
> 4e57407b8e4a
> a29271fd78f8
> e655021de0de
> 04480be1593e
> 999c62899c20
> 07fb52561c5c
> a3f5a8635cbb
> aaa265b0afa6
> eb9743315a9d
> 41157f1933d6
> e1146238edd3
> 
> ```

I fear your database migrations are currently in an inconsistent state. I have run the migration from a fresh instance and I got the following versions in the database:

```auto
1ba76da94103
9e0ac518b9df
a3957490361d
4e57407b8e4a
a29271fd78f8
04480be1593e
999c62899c20
07fb52561c5c
a3f5a8635cbb
aaa265b0afa6
41157f1933d6
e1146238edd3
5d25c1981985

```

As you can see, I do not have the following migrations:

```auto
e655021de0de
eb9743315a9d

```

And you do not have the following:

```auto
5d25c1981985

```

EDIT: it seems that the migration `e655021de0de` did not upgrade to `5d25c1981985`. They are from `invenio-oaiserver` (see [code](https://github.com/search?q=org%3Ainveniosoftware+repo%3Ainveniosoftware%2Finvenio-oaiserver++e655021de0de&type=code)) Thus, the difference.

Did you try to restore the database to an older version at some point? If so, it might have caused the issue.

Is your data safe to be wiped? If so, you can simply wipe it and run an upgrade again. To do so:

```auto
invenio db drop
invenio alembic upgrade

```

If the data is not meant to be wiped (e.g. production data), please let me know and we can try to fix the migrations using alembic solely.

---

<div class="post-metadata">

**Author:** ![GabomaGeek](https://invenio-talk.web.cern.ch/letter_avatar_proxy/v4/letter/g/df705f/32.png) [@GabomaGeek](https://invenio-talk.web.cern.ch/u/GabomaGeek)\
**Post date:** [13 January 2023 11:06 UTC](https://invenio-talk.web.cern.ch/t/upgrade-from-v9-to-v10/274/12 "2023-01-13T11:06:01Z")

</div>

It is a development environment. I followed your instructions and everything is fine now. Thanks you
