What is the error message you are getting? Are you getting a warning about lack of cloud storage? This may happen, if you do not have enough free cloud storage to upload the complete library again. Photos misestimating the required storage based on the worst case assumption that all photos in the library are different from the photos already in iCloud. So you need twice the storage to sync an existing library again. And Photos will not allow you to enable iCloud Photos, if you do not have enough storage for a second copy of the library.
If all your photos are still in iCloud you not need to restore the library from Time Machine. You can start over with a new, empty Photos Library ( Create additional libraries), make this library your System Photos Library (System Photo Library overview), then enable iCloud Photos ( Cloud Photos). This way Photos will not have to upload the library again into iCloud and complain about lack of Cloud storage. It will just download the photos from iCloud to your new library., and it will be much faster than syncing an existing library again.