Importing repo from github that work locally never work in replit

Everytime I try importing a github repo, whether a python app or nodejs the proper packages don’t get installed, when running normal command, packages break when installing and the install console process looks different. I’ve messed around with .replit file, I get openssl error, fix that and still same issues. Below is the python app example if someone can help me figure this out, I’d greatly appreciate it. Thanks.

https://replit.com/@gxz-dev/eiten-app#.replit

@gxz-dev Have you tried going into the Shell tab and entering the command git clone <repo url>? This works for me.

as opposed to importing directly from github when creating new replit?

@gxz-dev Yes.
Based on the fact that you posted this at all, importing directly from github hasn’t worked, so I would suggest trying the above tip.

1 Like

If it works, mark the above as the answer

So made it farther than ever so I appreciate it. I run the pip install command and says all packages are installed but when I run an actual python command it says the package is missing.

https://replit.com/@gxz-dev/UnfitGrowlingMonitors

Sorry for the late reply

What file would you like to have execute when you press the Run button? For instance if the file you’d like to run is ./eiten-app/eiten.py, then go into the .replit file and change the run="cowsay Configure me!" to run="python3 ./eiten-app/eiten.py".

If that doesn’t work then I suggest making a new Python Repl, using “git clone <repo url>” in the “Shell” again, and then editing the “.replit” file to have ‘run="python3 ./eiten-app/eiten.py"’

Thanks for the response! I don’t really require the run for this app. What needs to happen is the user runs “pip install -r requirements.txt” and that installs all packages, and then run one of the python commands in the ReadMe to output the graphs. My issue is I can manage to get the python to be correct version and the pip to be correct version, but every time I go to run a python command it says that theres multiple pthon packages and to choose one, when i do, it doesn’t recognize any of the packages I just installed, but when I re-run the install command, it says they are all installed. My replit.nix package only has one python version. I get a nix error when running python every time.

Try using this as your replit.nix file:

{ pkgs }: {
  deps = [
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
  ];
  env = {
    PYTHON_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
      # Needed for pandas / numpy
      pkgs.stdenv.cc.cc.lib
      pkgs.zlib
      # Needed for pygame
      pkgs.glib
      # Needed for matplotlib
      pkgs.xorg.libX11
    ];
    PYTHONHOME = "${pkgs.python310Full}";
    PYTHONBIN = "${pkgs.python310Full}/bin/python3.10";
    LANG = "en_US.UTF-8";
    STDERREDBIN = "${pkgs.replitPackages.stderred}/bin/stderred";
    PRYBAR_PYTHON_BIN = "${pkgs.replitPackages.prybar-python310}/bin/prybar-python310";
  };
}

I copied this out of one of my python repls, so hopefully this helps!
Edit: If there’s still errors, try adding this as your .replit file:

# The command that runs the program. If the interpreter field is set, it will have priority and this run command will do nothing
run = "cat readme.md"

# The primary language of the repl. There can be others, though!
language = "python3"
entrypoint = "main.py"
# A list of globs that specify which files and directories should
# be hidden in the workspace.
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"]

# Specifies which nix channel to use when building the environment.
[nix]
channel = "stable-22_11"

[env]
VIRTUAL_ENV = "/home/runner/${REPL_SLUG}/venv"
PATH = "${VIRTUAL_ENV}/bin"
PYTHONPATH = "$PYTHONHOME/lib/python3.10:${VIRTUAL_ENV}/lib/python3.10/site-packages"
REPLIT_POETRY_PYPI_REPOSITORY = "https://package-proxy.replit.com/pypi/"
MPLBACKEND = "TkAgg"
POETRY_CACHE_DIR = "${HOME}/${REPL_SLUG}/.cache/pypoetry"

# Enable unit tests. This is only supported for a few languages.
[unitTest]
language = "python3"

# Add a debugger!
[debugger]
support = true

  # How to start the debugger.
  [debugger.interactive]
  transport = "localhost:0"
  startCommand = ["dap-python", "main.py"]

    # How to communicate with the debugger.
    [debugger.interactive.integratedAdapter]
    dapTcpAddress = "localhost:0"

    # How to tell the debugger to start a debugging session.
    [debugger.interactive.initializeMessage]
    command = "initialize"
    type = "request"

      [debugger.interactive.initializeMessage.arguments]
      adapterID = "debugpy"
      clientID = "replit"
      clientName = "replit.com"
      columnsStartAt1 = true
      linesStartAt1 = true
      locale = "en-us"
      pathFormat = "path"
      supportsInvalidatedEvent = true
      supportsProgressReporting = true
      supportsRunInTerminalRequest = true
      supportsVariablePaging = true
      supportsVariableType = true

    # How to tell the debugger to start the debuggee application.
    [debugger.interactive.launchMessage]
    command = "attach"
    type = "request"

      [debugger.interactive.launchMessage.arguments]
      logging = {}

# Configures the packager.
[packager]
language = "python3"
ignoredPackages = ["unit_tests"]

  [packager.features]
  enabledForHosting = false
  # Enable searching packages from the sidebar.
  packageSearch = true
  # Enable guessing what packages are needed from the code.
  guessImports = true

# These are the files that need to be preserved when this 
# language template is used as the base language template
# for Python repos imported from GitHub
[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config", "venv"]

[languages]

[languages.python3]
pattern = "**/*.py"

[languages.python3.languageServer]
start = "pylsp"

[deployment]
run = ["sh", "-c", "python3 main.py"]

Locally its python 3.8 that I know works but I changed the replit.nix and when in the main file it knows the right python verison wihtout asking me to choose one which is nice. When i try running python get-pip.py --user to get the proper pip version, it shows and says succesfull installed but when i try checking pip version it says doesnt exist. See below.

~/UnfitGrowlingMonitors$ cd eiten-app/
~/UnfitGrowlingMonitors/eiten-app$ python --version
Python 3.10.8
~/UnfitGrowlingMonitors/eiten-app$ python get-pip.py --user
Collecting pip
  Using cached pip-23.0.1-py3-none-any.whl
Collecting setuptools
  Using cached setuptools-67.6.1-py3-none-any.whl (1.1 MB)
Collecting wheel
  Using cached wheel-0.40.0-py3-none-any.whl
Installing collected packages: wheel, setuptools, pip
Successfully installed pip-23.0.1 setuptools-67.6.1 wheel-0.40.0
~/UnfitGrowlingMonitors/eiten-app$ pip --version
Traceback (most recent call last):
  File "/home/runner/.local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'```

I… what? I don’t even know what’s happening here.

What is get-pip.py? pip should be a default install shouldn’t it?
Did you set the .replit file too?

Yes, I added the .replit code as well. The get-pip.py is the setup file to get the pip version 23.0.1. Either way, pip isn’t installed at any version.

The packages can’t run with Python 3.10 so I’ll have to update them but thanks for all the help seems like i’m making progress.

Ok so I found an old replit with version 3.8 so i copied the .replit and replit.nix files. Still same error when trying to install the proper pip version. I then add an incorrect line into the replit.nix file. When I run pip --version it seems to bypass the nix file and the python and pip verisons are correct. I even run the pip install -r requirements.txt file and it runs great. Then i try to run the python command to generate the charts and says i don’t have numpy package. See below for console log.

~/UnfitGrowlingMonitors$ pip --version
pip 23.0.1 from /home/runner/.local/lib/python3.8/site-packages/pip (python 3.8)
~/UnfitGrowlingMonitors$ cd eiten-app/
~/UnfitGrowlingMonitors/eiten-app$ pip --version
pip 23.0.1 from /home/runner/.local/lib/python3.8/site-packages/pip (python 3.8)
~/UnfitGrowlingMonitors/eiten-app$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Collecting certifi==2020.6.20
  Using cached certifi-2020.6.20-py2.py3-none-any.whl
Collecting chardet==3.0.4
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting cycler==0.10.0
  Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting idna==2.10
  Using cached idna-2.10-py2.py3-none-any.whl
Collecting joblib==0.16.0
  Using cached joblib-0.16.0-py3-none-any.whl
Collecting kiwisolver==1.2.0
  Using cached kiwisolver-1.2.0-cp38-cp38-manylinux1_x86_64.whl
Collecting matplotlib==3.3.1
  Using cached matplotlib-3.3.1-cp38-cp38-manylinux1_x86_64.whl
Collecting multitasking==0.0.9
  Using cached multitasking-0.0.9.tar.gz (8.1 kB)
  Preparing metadata (setup.py) ... done
Collecting numpy==1.20.3
  Using cached numpy-1.20.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Collecting pandas==1.3.0
  Using cached pandas-1.3.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Collecting Pillow==7.2.0
  Using cached Pillow-7.2.0-cp38-cp38-manylinux1_x86_64.whl
Collecting pyparsing==2.4.7
  Using cached pyparsing-2.4.7-py2.py3-none-any.whl
Collecting python-dateutil==2.8.1
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl
Collecting pytz==2022.5
  Using cached pytz-2022.5-py2.py3-none-any.whl
Collecting requests==2.26.0
  Using cached requests-2.26.0-py2.py3-none-any.whl
Collecting scikit-learn==0.23.2
  Using cached scikit_learn-0.23.2-cp38-cp38-manylinux1_x86_64.whl
Collecting scipy==1.5.2
  Using cached scipy-1.5.2-cp38-cp38-manylinux1_x86_64.whl
Collecting six==1.15.0
  Using cached six-1.15.0-py2.py3-none-any.whl
Collecting threadpoolctl==2.1.0
  Using cached threadpoolctl-2.1.0-py3-none-any.whl
Collecting tqdm==4.48.2
  Using cached tqdm-4.48.2-py2.py3-none-any.whl
Collecting urllib3==1.25.10
  Using cached urllib3-1.25.10-py2.py3-none-any.whl
Collecting yfinance==0.2.12
  Using cached yfinance-0.2.12-py2.py3-none-any.whl
Collecting charset-normalizer~=2.0.0
  Using cached charset_normalizer-2.0.12-py3-none-any.whl
Collecting beautifulsoup4>=4.11.1
  Downloading beautifulsoup4-4.12.0-py3-none-any.whl (132 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.2/132.2 kB 4.6 MB/s eta 0:00:00
Collecting frozendict>=2.3.4
  Downloading frozendict-2.3.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (112 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 112.6/112.6 kB 3.2 MB/s eta 0:00:00
Collecting cryptography>=3.3.2
  Downloading cryptography-40.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (3.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.7/3.7 MB 5.2 MB/s eta 0:00:00
Collecting lxml>=4.9.1
  Using cached lxml-4.9.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl
Collecting html5lib>=1.1
  Using cached html5lib-1.1-py2.py3-none-any.whl
Collecting appdirs>=1.4.4
  Using cached appdirs-1.4.4-py2.py3-none-any.whl
Collecting soupsieve>1.2
  Using cached soupsieve-2.4-py3-none-any.whl
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Collecting webencodings
  Using cached webencodings-0.5.1-py2.py3-none-any.whl
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl
Building wheels for collected packages: multitasking
  Building wheel for multitasking (setup.py) ... done
  Created wheel for multitasking: filename=multitasking-0.0.9-py3-none-any.whl size=8377 sha256=e417b484ba4a2a9f28a4bcad7d78d840faf5fe1c2b9559434964c0cf72415274
  Stored in directory: /home/runner/.cache/pip/wheels/57/6d/a3/a39b839cc75274d2acfb1c58bfead2f726c6577fe8c4723f13
Successfully built multitasking
Installing collected packages: webencodings, pytz, multitasking, chardet, certifi, appdirs, urllib3, tqdm, threadpoolctl, soupsieve, six, pyparsing, pycparser, Pillow, numpy, lxml, kiwisolver, joblib, idna, frozendict, charset-normalizer, scipy, requests, python-dateutil, html5lib, cycler, cffi, beautifulsoup4, scikit-learn, pandas, matplotlib, cryptography, yfinance
Successfully installed Pillow-7.2.0 appdirs-1.4.4 beautifulsoup4-4.12.0 certifi-2020.6.20 cffi-1.15.1 chardet-3.0.4 charset-normalizer-2.0.12 cryptography-40.0.1 cycler-0.10.0 frozendict-2.3.6 html5lib-1.1 idna-2.10 joblib-0.16.0 kiwisolver-1.2.0 lxml-4.9.2 matplotlib-3.3.1 multitasking-0.0.9 numpy-1.20.3 pandas-1.3.0 pycparser-2.21 pyparsing-2.4.7 python-dateutil-2.8.1 pytz-2022.5 requests-2.26.0 scikit-learn-0.23.2 scipy-1.5.2 six-1.15.0 soupsieve-2.4 threadpoolctl-2.1.0 tqdm-4.48.2 urllib3-1.25.10 webencodings-0.5.1 yfinance-0.2.12
~/UnfitGrowlingMonitors/eiten-app$ python3 portfolio_manager.py --is_test 1 --future_bars 30 --data_granularity_minutes 3600 --history_to_use 90 --apply_noise_filtering 1 --market_index QQQ --only_long 0 --eigen_portfolio_number 3 --stocks_file_path stocks/stocks.txt
python3: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
Adding python38Full to replit.nix
error: Could not read file replit.nix
/nix/store/d281rmpa8y4pbaw8dxmc0wa11kvnhdjr-python3-3.8.11
Traceback (most recent call last):
  File "portfolio_manager.py", line 4, in <module>
    from eiten import Eiten
  File "/home/runner/UnfitGrowlingMonitors/eiten-app/eiten.py", line 2, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
~/UnfitGrowlingMonitors/eiten-app$ pip --version
pip 23.0.1 from /home/runner/.local/lib/python3.8/site-packages/pip (python 3.8)
~/UnfitGrowlingMonitors/eiten-app$ numpy --version
bash: numpy: command not found
~/UnfitGrowlingMonitors/eiten-app$```

Hmm. Could you provide a link to the GitHub repo?

Sure, GitHub - GiancarloZ/eiten-app

Try forking this repl, and let me know if that does what you need? (I renamed eiten.py to main.py because I’m too lazy to redo .replit right now)
https://replit.com/@firepup650/eiten-app-test

Unfortunately, no luck. I get the below error while runing the install command. I appreciate the help though.

ERROR: No matching distribution found for pandas==1.3.0```

In the repl I setup for you, you should have no need to re-install the packages, just run it and see if it works.