mlco2 / mlco2/codecarbon

cannot create a new project

Open
#680 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API bug Dashboard
Dominant language
Python
Stars
1.9k
Forks
323
Avg merge
1d 12h
Merged PRs (30d)
12

Description

  • CodeCarbon version: v2.7.1
  • Python version: 3.12.3
  • Operating System: windows
Description

I'm trying to setup codecarbon for a project (the machine is Windows, but it runs in a docker container). I used pip to install it. When in the prompt after executing codecarbon config , I tried setting up a new project under the organization "Community organization". But it crashes since the project doesnt seem to have been created.
Is it because I try to use https://api.codecarbon.io/ as the API endpoint? Would it be different if I was running a codecarbon instance locally?
And I should mentionned I got the same kind of errors when trying to create a new organization. I should also mention that unlike what the doc says, codecarbon init is not a valid command.

What I Did

Here is the full interaction I had with the prompt, followed by the error traceback. Thanks for your help!

codecarbon config
Welcome to CodeCarbon configuration wizard
Creating new config file
Where do you want to put your config file ? [~/.codecarbon.config]: /workspaces/bd-goelette/harvester/.codecarbon.config
Config file created at /workspaces/bd-goelette/harvester/.codecarbon.config
Current API endpoint is https://api.codecarbon.io. Press enter to continue or input other url [https://api.codecarbon.io]: 
? Pick existing organization from list or Create new organization ? Community organization
[codecarbon ERROR @ 13:14:03] ApiClient Error when calling the API on https://api.codecarbon.io/organizations/e52fe339-164d-4c2b-a8c0-f562dfce066d/projects
[codecarbon ERROR @ 13:14:03] ApiClient API return http code 404 and answer : {"detail":"Not Found"}
? Pick existing project from list or Create new project ? Create New Project
Project name [Code Carbon user test]: test ogsl
Project description [Code Carbon user test]: test ogsl
[codecarbon ERROR @ 13:14:18] ApiClient Error when calling the API on https://api.codecarbon.io/projects with : {"name": "test ogsl", "description": "test ogsl", "organization_id": "e52fe339-164d-4c2b-a8c0-f562dfce066d"}
[codecarbon ERROR @ 13:14:18] ApiClient API return http code 404 and answer : {"detail":"Not Found"}
Created project : None
╭────────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────╮
│ /home/vscode/.local/lib/python3.12/site-packages/codecarbon/cli/main.py:175 in config                                                                         │
│                                                                                                                                                               │
│   172 │   │   print(f"Created project : {project}")                                                                                                           │
│   173 │   else:                                                                                                                                               │
│   174 │   │   project = [p for p in projects if p["name"] == project][0]                                                                                      │
│ ❱ 175 │   project_id = project["id"]                                                                                                                          │
│   176 │   overwrite_local_config("project_id", project_id, path=file_path)                                                                                    │
│   177 │                                                                                                                                                       │
│   178 │   experiments = api.list_experiments_from_project(project_id)   

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in codecarbon/cli/main.py around the config flow and reproduce the failure with codecarbon config using the API endpoint shown in the report. Trace how the 404 response is handled after project creation fails, and consider the behavior that should occur instead of indexing a missing project; done means the command handles this case without the reported traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.