Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble installing via MacOS and Ubuntu 22.0.4 #2

Closed
sullrich opened this issue Nov 22, 2023 · 5 comments
Closed

Trouble installing via MacOS and Ubuntu 22.0.4 #2

sullrich opened this issue Nov 22, 2023 · 5 comments

Comments

@sullrich
Copy link

sullrich commented Nov 22, 2023

What OS are you using to install rustgpt on? I am having trouble on both Ubuntu and MacOS getting this up and running.

For example on Ubuntu 22.0.4:

:~/rustgpt$ just dev
./tailwindcss -i input.css -o assets/output.css --watch=always
cargo watch -w src -w templates -w tailwind.config.js -w input.css -x run
[Running 'cargo run']
warning: unreachable pattern
--> src/ai/stream.rs:161:13
|
161 | _ => (),
| ^
|
= note: #[warn(unreachable_patterns)] on by default

warning: unused import: Row
--> src/data/repository.rs:4:12
|
4 | use sqlx::{Row, Sqlite, Transaction};
| ^^^
|
= note: #[warn(unused_imports)] on by default

warning: function internal_error is never used
--> src/main.rs:126:4
|
126 | fn internal_error(err: E) -> (StatusCode, String)
| ^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default

warning: variant DatabaseError is never constructed
--> src/router/app/auth.rs:31:5
|
29 | pub enum LogInError {
| ---------- variant in this enum
30 | InvalidCredentials,
31 | DatabaseError(String),
| ^^^^^^^^^^^^^
|
= note: LogInError has a derived impl for the trait Debug, but this is intentionally ignored during dead code analysis

warning: rustgpt (bin "rustgpt") generated 4 warnings
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running target/debug/rustgpt
thread 'main' panicked at src/main.rs:42:48:
called Result::unwrap() on an Err value: EnvVar(NotPresent)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[Finished running. Exit status: 101]

Sorry for asking a n00b question. My strengths are more with golang where we don't seem to have these kind of issues.

@jimzer
Copy link
Contributor

jimzer commented Nov 22, 2023

Hey :)

Actually I develop on MacOS and I deploy on a Ubuntu VM inside docker.

From the error it seems that you miss some environment variables.
Did you create the .env file with all the required variables?

No problem! I will do my best to help you make it work 👍🏽

@sullrich
Copy link
Author

Doh! I forgot to create .env on the Ubuntu box. Working now. However still failing on my MacOS box - I'll keep digging. Thanks!

@jimzer
Copy link
Contributor

jimzer commented Nov 22, 2023

Great!

Do you have the same error on Mac?
If it's a different one, send it to me and I can maybe help :)

@sullrich
Copy link
Author

Appreciate your time! Here's the output:

./tailwindcss -i input.css -o assets/output.css --watch=always
cargo watch -w src -w templates -w tailwind.config.js -w input.css -x run

Rebuilding...
Compiling rustgpt v0.1.0 (/Users/sullrich/rustgpt)
Building [=======================> ] 357/358: rustgpt(bin)
Done in 438ms.
warning: unreachable pattern
--> src/ai/stream.rs:161:13
|
161 | _ => (),
| ^
|
= note: #[warn(unreachable_patterns)] on by default

warning: unused import: Row
--> src/data/repository.rs:4:12
|
4 | use sqlx::{Row, Sqlite, Transaction};
| ^^^
|
= note: #[warn(unused_imports)] on by default

error[E0446]: private type AppState in public interface
--> src/router/app/home.rs:13:1
|
13 | / pub async fn app(
14 | | State(state): State<Arc>,
15 | | Extension(current_user): Extension<Option>,
16 | | ) -> Html {
| |_________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/home.rs:13:1
|
13 | / pub async fn app(
14 | | State(state): State<Arc>,
15 | | Extension(current_user): Extension<Option>,
16 | | ) -> Html {
| |_________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537
= note: #[warn(private_in_public)] on by default

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:61:1
|
61 | / pub async fn chat(
62 | | State(state): State<Arc>,
63 | | Extension(current_user): Extension<Option>,
64 | | ) -> Html {
| |_________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/chat.rs:61:1
|
61 | / pub async fn chat(
62 | | State(state): State<Arc>,
63 | | Extension(current_user): Extension<Option>,
64 | | ) -> Html {
| |_________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:94:1
|
94 | / pub async fn new_chat(
95 | | State(state): State<Arc>,
96 | | Extension(current_user): Extension<Option>,
97 | | Form(new_chat): Form,
98 | | ) -> Result<Response, ChatError> {
| |________________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/chat.rs:94:1
|
94 | / pub async fn new_chat(
95 | | State(state): State<Arc>,
96 | | Extension(current_user): Extension<Option>,
97 | | Form(new_chat): Form,
98 | | ) -> Result<Response, ChatError> {
| |________________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:128:1
|
128 | / pub async fn chat_by_id(
129 | | Path(chat_id): Path,
130 | | State(state): State<Arc>,
131 | | Extension(current_user): Extension<Option>,
132 | | ) -> Result<Html, ChatError> {
| |____________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/chat.rs:128:1
|
128 | / pub async fn chat_by_id(
129 | | Path(chat_id): Path,
130 | | State(state): State<Arc>,
131 | | Extension(current_user): Extension<Option>,
132 | | ) -> Result<Html, ChatError> {
| |____________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:190:1
|
190 | / pub async fn chat_add_message(
191 | | Path(chat_id): Path,
192 | | State(state): State<Arc>,
193 | | Extension(current_user): Extension<Option>,
194 | | Form(chat_add_message): Form,
195 | | ) -> Result<Html, ChatError> {
| |
___________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/chat.rs:190:1
|
190 | / pub async fn chat_add_message(
191 | | Path(chat_id): Path,
192 | | State(state): State<Arc>,
193 | | Extension(current_user): Extension<Option>,
194 | | Form(chat_add_message): Form,
195 | | ) -> Result<Html, ChatError> {
| |
___________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:214:1
|
214 | / pub async fn chat_generate(
215 | | Extension(current_user): Extension<Option>,
216 | | Path(chat_id): Path,
217 | | State(state): State<Arc>,
218 | | ) -> Result<Sse<impl tokio_stream::Stream<Item = Result<Event, axum::Error>>>, ChatError> {
| |_________________________________________________________________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/router/app/chat.rs:312:1
|
312 | / pub async fn delete_chat(
313 | | Path(chat_id): Path,
314 | | State(state): State<Arc>,
315 | | ) -> Result<Html, ChatError> {
| |____________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/router/app/auth.rs:16:1
|
16 | pub async fn login(State(state): State<Arc>) -> Html {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/router/app/auth.rs:56:1
|
56 | / pub async fn login_form(
57 | | cookies: Cookies,
58 | | state: State<Arc>,
59 | | Form(log_in): Form,
60 | | ) -> Result<Redirect, LogInError> {
| |_________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/auth.rs:56:1
|
56 | / pub async fn login_form(
57 | | cookies: Cookies,
58 | | state: State<Arc>,
59 | | Form(log_in): Form,
60 | | ) -> Result<Redirect, LogInError> {
| |_________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/auth.rs:84:1
|
84 | pub async fn signup(State(state): State<Arc>) -> Html {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/router/app/auth.rs:124:1
|
124 | / pub async fn form_signup(
125 | | state: State<Arc>,
126 | | Form(sign_up): Form,
127 | | ) -> Result<Redirect, SignUpError> {
| |__________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/auth.rs:124:1
|
124 | / pub async fn form_signup(
125 | | state: State<Arc>,
126 | | Form(sign_up): Form,
127 | | ) -> Result<Redirect, SignUpError> {
| |__________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/blog.rs:22:1
|
22 | / pub async fn blog(
23 | | State(state): State<Arc>,
24 | | Extension(current_user): Extension<Option>,
25 | | ) -> Result<Html, StatusCode> {
| |_____________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/router/app/blog.rs:80:1
|
80 | / pub async fn blog_by_slug(
81 | | Path(slug): Path,
82 | | State(state): State<Arc>,
83 | | Extension(current_user): Extension<Option>,
84 | | ) -> Result<Html, StatusCode> {
| |_____________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/blog.rs:80:1
|
80 | / pub async fn blog_by_slug(
81 | | Path(slug): Path,
82 | | State(state): State<Arc>,
83 | | Extension(current_user): Extension<Option>,
84 | | ) -> Result<Html, StatusCode> {
| |_____________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/settings.rs:21:1
|
21 | / pub async fn settings_openai_api_key(
22 | | State(state): State<Arc>,
23 | | Extension(current_user): Extension<Option>,
24 | | Form(set_openai_api_key): Form,
25 | | ) -> Result<Redirect, StatusCode> {
| |_________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/settings.rs:21:1
|
21 | / pub async fn settings_openai_api_key(
22 | | State(state): State<Arc>,
23 | | Extension(current_user): Extension<Option>,
24 | | Form(set_openai_api_key): Form,
25 | | ) -> Result<Redirect, StatusCode> {
| |_________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/settings.rs:38:1
|
38 | / pub async fn settings(
39 | | State(state): State<Arc>,
40 | | Extension(current_user): Extension<Option>,
41 | | ) -> Result<Html, StatusCode> {
| |_____________________________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/settings.rs:38:1
|
38 | / pub async fn settings(
39 | | State(state): State<Arc>,
40 | | Extension(current_user): Extension<Option>,
41 | | ) -> Result<Html, StatusCode> {
| |_____________________________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/error.rs:20:1
|
20 | / pub async fn error(
21 | | Query(params): Query,
22 | | State(state): State<Arc>,
23 | | Extension(current_user): Extension<Option>,
24 | | ) -> Html {
| |_________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: private type AppState in public interface (error E0446)
--> src/router/app/error.rs:20:1
|
20 | / pub async fn error(
21 | | Query(params): Query,
22 | | State(state): State<Arc>,
23 | | Extension(current_user): Extension<Option>,
24 | | ) -> Html {
| |_________________^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #34537 rust-lang/rust#34537

error[E0446]: private type AppState in public interface
--> src/router/app/mod.rs:25:1
|
25 | pub fn app_router(state: Arc) -> Router {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/middleware.rs:25:1
|
25 | / pub async fn extract_user(
26 | | State(state): State<Arc>,
27 | | cookies: Cookies,
28 | | mut req: Request,
... |
31 | | where
32 | | B: Send + 'static,
| |______________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

error[E0446]: private type AppState in public interface
--> src/middleware.rs:112:1
|
112 | / pub async fn handle_error(
113 | | Extension(current_user): Extension<Option>,
114 | | State(state): State<Arc>,
115 | | req: Request,
... |
118 | | where
119 | | B: Send + 'static,
| |______________________^ can't leak private type
|
::: src/main.rs:26:1
|
26 | struct AppState {
| --------------- AppState declared as private

warning: function internal_error is never used
--> src/main.rs:126:4
|
126 | fn internal_error(err: E) -> (StatusCode, String)
| ^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default

warning: variant DatabaseError is never constructed
--> src/router/app/auth.rs:31:5
|
29 | pub enum LogInError {
| ---------- variant in this enum
30 | InvalidCredentials,
31 | DatabaseError(String),
| ^^^^^^^^^^^^^
|
= note: LogInError has a derived impl for the trait Debug, but this is intentionally ignored during dead code analysis

For more information about this error, try rustc --explain E0446.
warning: rustgpt (bin "rustgpt") generated 15 warnings
error: could not compile rustgpt (bin "rustgpt") due to 19 previous errors; 15 warnings emitted

@jimzer
Copy link
Contributor

jimzer commented Nov 23, 2023

No problem :)

Could you print the version of your rust toolchain? (rustc --version from inside the folder you run the code)

The one I'm using is: rustc 1.75.0-nightly (ab5c841a1 2023-10-25)

Normally it should be installed automatically since the file rust-toolchain.toml contains:

[toolchain]
channel = "nightly-2023-10-26"
components = ["rustfmt", "clippy", "rust-src"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants