Panda Library not working

Question:
wanted to use the panda library but not able to use it

Current behavior:
made a reuirements.txt file and put the following code
Wand==0.6.6
made a python file name main.py and made the following code in it
import os

# Install ImageMagick using apt
os.system('apt-get install imagemagick -y')

from wand.image import Image

# Your pandas and ImageMagick-related code here

data = {'Name': ['Alice', 'Bob', 'Charlie'],
        'Age': [25, 30, 35]}

df = pd.DataFrame(data)
df.to_csv('output.csv', index=False)

error with the code :-nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
b) for nixos-rebuild you can add ‘imagemagick-6.9.12-68’ to
nixpkgs.config.permittedInsecurePackages in the configuration.nix,
like so:

        {
          nixpkgs.config.permittedInsecurePackages = [
            "imagemagick-6.9.12-68"
          ];
        }

   c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
      ‘imagemagick-6.9.12-68’ to `permittedInsecurePackages` in
      ~/.config/nixpkgs/config.nix, like so:

        {
          permittedInsecurePackages = [
            "imagemagick-6.9.12-68"
          ];
        }

Desired behavior
wanted to run the above mentioned python code

Hi @23f2003751 , welcome to the forums!
First, Replit doesn’t really use requirements.txt. To install pandas, enter poetry add pandas in the Shell.
Next, click the 3 dots in the Files sidebar and click on Show Hidden Files.
Select the replit.nix file and make sure that it looks like this:

{ pkgs }: {
  deps = [

  ];
}

If it doesn’t please change it to the code above.
Your program should work now.
Hope this helps!

1 Like

This does not fix the wand library.
Also, there is a new System dependencies Tool that is better for editing nix packages.

And may i know what this is, and how to use it?

System Dependencies is a new tool that Replit’s made that makes it easy to edit your Nix configuration:

image

When opened, you can remove packages that you’ve added to your replit.nix as well as open the config file.

image

Currently you cannot add new packages, the only way to do this is via the Shell or manually adding it to the replit.nix file.

2 Likes

I know the feature, but you are trying to say that arguably you could install yarn packages in a Python repl?
But isn’t the issue here installation of wand? Won’t poetry add wand do the trick?

Technically yes, however there’d be no point to it.

Plus the only reason yarn is there is because I added it to my own replit.nix in a different Repl.

I mean, I was under the impression you thought said it was a Nix issue and told OP to empty their replit.nix, and then you also asked about System Dependencies which I just stated what it’s for.

1 Like

It is, isn’t it? There should be no reason why OP is using Nix packages, not Python packages. Hence the reason of emptying replit.nix.

There could always be a reason OP is using Nix packages. Maybe they do need imagemagick, as said on line 2 of their code (albeit them using apt-get which doesn’t work on Replit):

2 Likes